Linux Ubuntu16.04LTS安装TensorFlow,CPU-only,python3.7——使用Anaconda安装

1、安装Anaconda(在此不再赘述)

2、用Conda安装TensorFlow

1)建立TensorFlow运行环境并激活

conda create -n tensorflow pip python=2.7 #建立环境 或者python=3.4
source activate tensorflow   #激活 (以后每次要使用tensorflow都需要执行此命令)   注:source deactivate #执行退出环境

2)安装TensorFlow

在Conda环境下执行(Python 2.7 CPU only版本):

pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.6.0-cp27-none-linux_x86_64.whl

其他版本地址参考网址:https://www.tensorflow.org/install/install_linux#the_url_of_the_tensorflow_python_package

3)安装完成并测试

$ python

import tensorflow as tf

hello=tf.constant('hello tensorflow!')

sess=tf.Session()

print(sess.run(hello))

结果为hello tensorflow!则安装成功

4)退出python环境命令:quit()

5)退出TensorFlow环境:source deactivate

6)退出终端:exit