1: First, determine the cuda and cudnn versions that need to be installed according to the tensorflow-gpu version you need to use.
2: If we need to install 1.6.0 gpu, then we need to install cuda 9.0 and cudnn 7.0 first
3: cuda download address: https://developer.nvidia.com/cuda-90-download-archive
sudo chmod +x cuda_9.0.176_384.81_linux.run # 为 cuda_9.0.176_384.81_linux.run 添加可执行权限
./cuda_9.0.176_384.81_linux.run # 安装 cuda_9.0.176_384.81_linux.run
Modify the /etc/profile file
sudo vim /etc/profile
Add at the end
export PATH=/usr/local/cuda/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda/lib64$LD_LIBRARY_PATH
export CUDA_HOME=/usr/local/cuda
Just source it again
source /etc/profile
sudo ldconfig
nvcc --version can view the version of cuda
4: cudnn download address: https://developer.nvidia.com/rdp/cudnn-download
sudo cp cuda/include/cudnn.h /usr/local/cuda-9.0/include
sudo cp cuda/lib64/libcudnn* /usr/local/cuda-9.0/lib64
sudo chmod a+r /usr/local/cuda-9.0/include/cudnn.h /usr/local/cuda-9.0/lib64/libcudnn*