1. 准备好Anaconda环境
具体参见:http://blog.csdn.net/zhdgk19871218/article/details/46502637
方法一: 通用方法, 不推荐(如果需要配置多个TensorFlow环境,会导致版本冲突)!
2. pip安装TensorFlow
强烈推荐采用清华大学开源软件镜像站安装:
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple/ https://mirrors.tuna.tsinghua.edu.cn/tensorflow/linux/cpu/tensorflow-1.2.1-cp36-cp36m-linux_x86_64.whl
注意,上面代码里的cp36-cp36m的36是指你电脑里的python版本!!!
附上链接(建议从此链接获得相应的安装命令代码):https://mirrors.tuna.tsinghua.edu.cn/help/tensorflow/, 可以选择对应的Python版本以及CPU/GPU版本.
方法二: 用于一台电脑安装不同版本的TensorFlow, 推荐!
注意: 这种方法会导致Anaconda的众多第三方库无法在TensorFlow的计算环境里使用, 需要激活TensorFlow环境后另安装!
2. 建立名叫TensorFlow的计算环境
1 # Python 2.7 2 $ conda create -n tensorflow python=2.7 3 4 # Python 3.6 5 $ conda create -n tensorflow python=3.6
3. 激活TensorFlow环境,然后用pip安装TensorFlow
激活:
1 source activate tensorflow
安装(强烈推荐采用清华大学开源软件镜像站安装:https://mirrors.tuna.tsinghua.edu.cn/ ):
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple/ https://mirrors.tuna.tsinghua.edu.cn/tensorflow/linux/cpu/tensorflow-1.2.1-cp36-cp36m-linux_x86_64.whl
注意,上面代码里的cp36-cp36m的36是指你电脑里的python版本!!!
附上链接(建议从此链接获得相应的安装命令代码):https://mirrors.tuna.tsinghua.edu.cn/help/tensorflow/
4. 激活与退出TensorFlow
1 # 2 # To activate this environment, use: 3 # > source activate tensorflow 4 # 5 # To deactivate this environment, use: 6 # > source deactivate tensorflow 7 #
5. 检查是否安装成功
无报错,即安装成功!