Install Tensorflow-gpu in Linux

Install Nvidia Driver

If you haven't installed Nvidia Driver, you can go to my previous article.

Install CUDA

  • Download CUDA.
  • Install
    sudo sh cuda_9.0.176_384.81_linux.run
  • Add PATH into .bashrc
export PATH="/usr/local/cuda-9.0/bin:$PATH"
export LD_LIBRARY_PATH="/usr/local/cuda-9.0/lib64:$LD_LIBRARY_PATH"

Install cuDNN

tar -zxvf cudnn-9.0-linux-x64-v7.tgz
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
sudo chmod a+r /usr/local/cuda/lib64/libcudnn*

Install Anaconda

Install Tensorflow-gpu

pip install Tensorflow-gpu
If it report an error ‘importerror: libcuda.so.1: cannot open shared object file: no such file or directory’, try to install libcuda
sudo apt install libcuda1

你可能感兴趣的:(Install Tensorflow-gpu in Linux)