Ubuntu16.04通过Anaconda安装TensorFlow-GPU版

1. 下载Anaconda,网址//www.continuum.io/downloads,文件较大,耐心下载

2. 安装Anaconda

bash Anaconda3-5.2.0-Linux-x86_64.sh

3. 建立TensorFlow运行环境,并激活

首先添加清华大学的镜像源,后面可以加快下载的速度(慎重添加该源,因为该源不提供最新版本的TensorFlow)

#conda config --add channels "https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/"

#conda config --add channels "https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/"

conda config --set show_channel_urls yes

可以自行选择要激活的环境使用的Python版本号: 

conda create -n tensorflow python=3.6
source activate tensorflow

4. 安装TensorFlow,对于CUDA8.0及cuDNN5.0以上版本,直接安装:

conda install tensorflow-gpu

等待下载安装即可

5. 测试是否安装成功

import tensorflow as tf
 hello=tf.constant('Hello, Tensorflow')
sess = tf.Session() 
print(sess.run(hello))

6. 查看TensorFlow版本号

anaconda search -t conda tensorflow

猜你喜欢

转载自blog.csdn.net/lukaslong/article/details/81092032