Deep learning setup on Ubuntu

Install GPU driver, CUDA, Cudnn

sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt-get install nvidia-375
sudo reboot

GPU info can be viewed using


Download CUDA 8.0

When asked whether to install GPU driver, select No

All the other select yes

Add CUDA to system environment 

export PATH=/usr/local/cuda-8.0/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda-8.0/lib64:$LD_LIBRARY_PATH

check version

nvcc -V

Download cudnn 6


tar -xvf cudnn-8.0-linux-x64-v6.0.tgz
sudo cp lib* /usr/local/cuda-8.0/lib64/
sudo cp cudnn.h /usr/local/cuda-8.0/include/

Tensorflow (CUDA8+Cudnn6)


Install The libcupti-dev library, which is the NVIDIA CUDA Profile Tools Interface. This library provides advanced profiling support. 

sudo apt-get install libcupti-dev

Install pip and Virtualenv:

# Ubuntu/Linux 64-bit

sudo apt-get install python-pip python-dev python-virtualenv

Create a Virtualenv environment in the directory ~/tensorflow:

virtualenv --system-site-packages ~/tensorflow

Activate the environment:

source ~/tensorflow/bin/activate  # If using bash
source ~/tensorflow/bin/activate.csh  # If using csh

(tensorflow)$  # Your prompt should change

Now, install TensorFlow just as you would for a regular Pip installation. First select the correct binary to install:

(tensorflow)$ pip install --upgrade tensorflow      # for Python 2.7
(tensorflow)$ pip3 install --upgrade tensorflow     # for Python 3.n
(tensorflow)$ pip install --upgrade tensorflow-gpu  # for Python 2.7 and GPU
(tensorflow)$ pip3 install --upgrade tensorflow-gpu # for Python 3.n and GPUFinally install TensorFlow:

When you are done using TensorFlow, deactivate the environment.

(tensorflow)$ deactivate


export PATH=/usr/local/cuda-9.0/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda-9.0/lib64:$LD_LIBRARY_PATH

Cudnn 7

Last Article Next article

Comment 评论

Share 分享

New Users 最新加入

  • zhangping

  • shawn_gao

  • 在路上的猫

New comments 最新评论

admin: Thanks! Details 04月09日 11:46
admin: Google map api Details 04月09日 11:46
lqj12: cooooooooool Details 04月08日 21:34
Yunhan Huang: 这个功能是如何实现的? Details 04月08日 13:23
lackenthu: 资词! Details 03月30日 16:41