安装好 anaconda后,即可通过anaconda安装tensorflow
steps specially:
1.创建虚拟环境
(为Anaconda创建一个python3.5(或者3.6都行,随便)的环境,环境名称为tensorflow ,输入下面命令)
conda
create -n tensorflow pip python=3.6
2.激活环境 (不使用时关闭环境)
source
activate tensorflow (source
deactivate tensorflow)
3.安装TensorFlow (cpu版本的)
pipinstall--upgrade--ignore-installedtensorflow
4.运行test.py验证脚本
import tensorflow as tf
hello = tf.constant('Hello, TensorFlow!')
sess = tf.Session()
print(sess.run(hello))
运行 no errors 即 install success
//如何不激活环境即可使用tensorflow环境
#退出tensorflow环境source deactivate tensorflow
#运行pip install tensorflow
pipinstall --upgrade pip