Ubuntu服务器上使用Anaconda安装TensorFlow(gpu)
最近学习CNN,需要在服务器上安装TensorFlow。硬件环境:GTX-1080,软件环境:Ubuntu-16.04。以下是踩过的坑:
一、首先在Ubuntu上安装Anaconda;
1、下载清华源的Anaconda安装包。一开始我是从Anaconda官网上直接下载的安装包,安装过程种出错。以下是清华源Anaconda的安装包网址:https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/,这里我选择的Anaconda版本为Anaconda3-5.2.0-Linux-x86_64.sh,一开始我安装的是Anaconda3-5.3.1-Linux-x86_64.sh,这一版安装的之后会出现conda不存在错误。
2、执行安装命令:bash Anaconda3-5.2.0-Linux-x86_64.sh 安装。
二、使用conda安装TensorFlow:
1、TensorFlow安装时需要注意cuda+对应的显卡驱动。现在自己服务器上输入命令行:nvidia-smi 出现:
图片中Driver Version:384.130,就是驱动的版本好,需要去nvidia官网上查看对应的显卡驱以下是链接:https://docs.nvidia.com/cuda/cuda-toolkit-release-notes/index.html 我服务器上是CUDA 9.0,所以安装,版本为:tensorflow-gpu==1.9。
2、安装TensorFlow,执行命令:conda install tensorflow-gpu==1.9,耐性等待。waiting
3、测试是否已经安装好了tensorflow:启动python依次输入以下命令:
$python
>>>import tensorflow as tf
>>>hello = tf.constant("Hello world!")
>>>sess = tf.Session()
>>>print(sess.run(hello))
Hello world! ##输出就表示成功
以上就是基于Anaconda安装TensorFlow (GPU版本)。