安装好系统之后首先要先安装显卡驱动
可到NVIDA官网下载所需的显卡版本或者只是用以下代码实现安装
sudo apt-get install nvidia-375
1. 安装anacodna
下载网址:https://www.anaconda.com/download/
sudo bash Anaconda2-4.4.0-Linux-x86_64.sh
如果是anaconda3只需改成相应的版本名称就是了
2. 安装bazel
$ echo "deb [arch=amd64] http://storage.googleapis.com/bazel-apt stable jdk1.8" | sudo tee /etc/apt/sources.list.d/bazel.list $ curl https://storage.googleapis.com/bazel-apt/doc/apt-key.pub.gpg | sudo apt-key add - $ sudo apt-get update $ sudo apt-get install bazel $ sudo apt-get upgrade bazel
3.安装cuda8.0
请到官网下载与自己配置相对应的软件包https://developer.nvidia.com/cuda-downloads
安装代码:
- $ sudo dpkg -i cuda-repo-ubuntu1404-8-0-local-ga2_8.0.61-1_amd64.deb
- $ sudo apt-get update
- $ sudo apt-get install cuda
4. 安装CUDNN(Installing from a Tar File)
- Navigate to your <installpath> directory containing cuDNN.
- Unzip the cuDNN package.
$ tar -xzvf cudnn-9.0-linux-x64-v7.tgz
- Copy the following files into the CUDA Toolkit directory.
$ 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 /usr/local/cuda/lib64/libcudnn*
-
Follow the instructions on the Anaconda download site to download and install Anaconda.
-
Create a conda environment named tensorflow to run a version of Python by invoking the following command:
$ conda create -n tensorflow
-
Activate the conda environment by issuing the following command:
$ source activate tensorflow (tensorflow)$ # Your prompt should change
-
Issue a command of the following format to install TensorFlow inside your conda environment:
(tensorflow)$ pip install --ignore-installed --upgrade tfBinaryURL
where
tfBinaryURL
is the URL of the TensorFlow Python package. For example, the following command installs the CPU-only version of TensorFlow for Python 3.4:
To validate your TensorFlow installation, do the following:
- Ensure that your environment is prepared to run TensorFlow programs.
- Run a short TensorFlow program.
Run a short TensorFlow program
Invoke python from your shell as follows:
$ python
Enter the following short program inside the python interactive shell:
# Python
import tensorflow as tf
hello = tf.constant('Hello, TensorFlow!')
sess = tf.Session()
print(sess.run(hello))
If the system outputs the following, then you are ready to begin writingTensorFlow programs:
Hello, TensorFlow!
If you are new to TensorFlow, see Getting Started with TensorFlow.
If the system outputs an error message instead of a greeting, see Commoninstallation problems.
相关链接:https://alliseesolutions.wordpress.com/2016/09/08/install-gpu-tensorflow-from-sources-w-ubuntu-16-04-and-cuda-8-0/
https://alliseesolutions.wordpress.com/2016/07/05/how-to-install-gpu-tensorflow-0-9-from-sources-ubuntu-14-04/
https://developer.nvidia.com/cuda-downloads
https://www.tensorflow.org/install/
http://docs.nvidia.com/deeplearning/sdk/cudnn-install/index.html#installcuda
http://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#axzz4rgaP0Hm8