Graphics cards: GeForce RTX 2080 Ti
system: 18.04
1. Select the version
https://www.tensorflow.org/install/source#common_installation_problems
https://blog.csdn.net/qq_27825451/article/details/89082978
Linux, GPU
Version Python version Compiler Build tools cuDNN CUDA
tensorflow-2.0.0 2.7, 3.3-3.7 GCC 7.3.1 Bazel 0.26.1 7.4 10.0
2. ubuntu system installation
3. NVIDIA driver installation
3.1 nouveau disabled and reboot
Input lsmod | grep nouveau
the output, indicating nouveau is working
sudo gedit /etc/modprobe.d/blacklist.conf
blacklist nouveau options
nouveau modeset=0
Restart, input lsmod | grep nouveau
no output, normal inspection by
3.2 auxiliary work
sudo yum -y install gcc-c++
sudo apt-get update
3.3 Download run file
Selected nvidia driver version
ubuntu-drivers devices
Download: https: //www.nvidia.cn/Download/index.aspx lang = cn?
3.4 Installation
Before installing the driver networking, subsequent to install a package, you can change the source to look at Tsinghua source, some of the fast
by Ctrl+Alt+F3
entering the terminal
service lightdm stop
Note: This step should be, because the conflict with the nvidia driver, turn off
sudo chmod +x NVIDIA-Linux-x86_64-430.26.run
sudo bash NVIDIA-Linux-x86_64-430.26.run –no-opengl-files –no-x-check
Note: You must add parameters * -no -opengl-files *, or page cycle login
parameters during reference: https: //blog.csdn.net/wf19930209/article/details/95237824
sudo apt install lightdm
service lightdm start
on lightdm reference link: (https://blog.csdn.net/ chentianting / article / details / 85089403)
return to the main meetingctrl + alt + f2
3.6 result
nvidia-smi
3.5 Pit Record
In my system uses direct sudo apt-get install nvidia-settings nvidia-driver-430 nvidia-prime
way will fall into the boot process cycle login interface.
However, this method is effective in a lot of links, such as: https: //blog.csdn.net/BigData_Mining/article/details/99670642
should look at their computer have different reactions in different situations.
4. cuda 10.0 install
Note here Download cuda10.0 rather than 10.1, cuda10.1 incompatible tensorflow2.0
download link:
http://developer.nvidia.com/cuda-downloads
sudo sh cuda_XXX_linux.run
- Installation process
Driver is not installed (Step 2 installed Cause)
- Add the environment variable by bashrc, operating trilogy, open, add, take effect
gedit ~/.bashrc
export CUDA_HOME=/usr/local/cuda
export PATH=$PATH:$CUDA_HOME/bin
export LD_LIBRARY_PATH=/usr/local/cuda-10.0/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
source ~/.bashrc
- Cuda installation test success
cd /usr/local/cuda/samples/1_Utilities/deviceQuery
sudo make
./deviceQuery
Result = Pass appear successful installation
cuda10.1 Uninstall
sudo /usr/local/cuda-10.1/bin/cuda-uninstaller
At the same time in accordance with the trilogy, open, add, take effect; commented cuda's PATH
#export PATH="/usr/local/cuda-10.0/bin:$PATH"
#export LD_LIBRARY_PATH="/usr/lcoal/cuda-10.0/lib64:$LD_LIBRARY_PATH"```
5.cudnn installation
Nvidia account login, download: https://developer.nvidia.com/rdp/cudnn-archive, select cuDNN library for linux
version
Unzip and copy into the folder +
sudo cp cuda/include/cudnn.h /usr/local/cuda/include/
sudo cp cuda/lib64/libcudnn* /usr/local/cuda/lib64/
sudo chmod a+r /usr/local/cuda/include/cudnn.h
Test installation was successful or not
cat /usr/local/cuda/include/cudnn.h | grep CUDNN_MAJOR -A 2
From top to bottom in order to show that the 761 version 7.6.1
6. ananconda python 3.6 installed
Tsinghua download mirrors by anaconda version, note the version corresponding to the latest 3-5.3.0 corresponds to python3.7 and tensorflow does not meet the requirements, download Anaconda3-5.2.0
after download and install, pay attention to further use Jupyter, Spyder install link in this article /usr/local/anaconda3
( reference link: https: //www.cnblogs.com/jisongxie/p/10053760.html)
sh Anaconda3-5.2.0-Linux-x86_64.sh
The second step to modify the installation path
Trilogy environment variables:
sudo gedit /etc/profile
End of the text
export PATH=/usr/local/anaconda3/bin:$PATH
source /etc/profile
Shutdown efficiently restarted, the terminal input words python has anaconda
Uninstall anaconda
- Remove directory
rm -rf /usr/local/anaconda3
Here, if the installation files are to Home
rm -rf ~/anaconda3
- Trilogy cleaning path
sudo gedit /etc/profile
orsudo gedit ~/.bashrc
comment out anaconda3 relevant content#export PATH=/usr/local/anaconda3/bin:$PATH
https://blog.csdn.net/weixin_41528941/article/details/90903584 or links such as
commencementsource /etc/profile
orsource ~/.bashrc
re-opening the terminal or active power-on reset, no input output Python
7. tensorflow 2.0 install
sudo pip install --upgrade pip
sudo pip install tensorflow-gpu==2.0.0-alpha0
- t Alternative Method: Thunder download file before mounting wheel
https://pypi.tuna.tsinghua.edu.cn/packages/1a/66/32cffad095253219d53f6b6c2a436637bbe45ac4e7be0244557210dc3918/tensorflow_gpu-2.0.0a0-cp36-cp36m-manylinux1_x86_64.whl
sudo pip install tensorflow_gpu-2.0.0a0-cp36-cp36m-manylinux1_x86_64.whl
ceshi:
https://tensorflow.google.cn/tutorials/quickstart/beginner
from __future__ import absolute_import, division, print_function, unicode_literals
# Install TensorFlow
import tensorflow as tf
mnist = tf.keras.datasets.mnist
(x_train, y_train), (x_test, y_test) = mnist.load_data()
x_train, x_test = x_train / 255.0, x_test / 255.0
model = tf.keras.models.Sequential([
tf.keras.layers.Flatten(input_shape=(28, 28)),
tf.keras.layers.Dense(128, activation='relu'),
tf.keras.layers.Dropout(0.2),
tf.keras.layers.Dense(10, activation='softmax')
])
model.compile(optimizer='adam',
loss='sparse_categorical_crossentropy',
metrics=['accuracy'])
model.fit(x_train, y_train, epochs=1)
model.evaluate(x_test, y_test, verbose=2)