版本:
Python 2.7
Tensorflow 1.3.0
下载Anaconda
先进入Anaconda官网,然后下载Python 2.7 version,一路点继续安装就好。
安装Tensorflow
第一步,打开终端。
第二步,创建Conda新环境,命名为Tensorflow:
$ conda create -n tensorflow pip python=2.7
中间会有Proceed请求,输入y,然后回车键就好。
第三步,激活Tensorflow环境:
$ source activate tensorflow
第四步,在该环境中安装Tensorflow:
$ pip install --ignore-installed --upgrade \
https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-1.3.0-py2-none-any.whl
第五步,进入Python,测试Tensorflow是否安装成功:
$ python
Python 2.7.14 |Anaconda, Inc.| (default, Dec 7 2017, 11:07:58)
[GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
>>> tf.__version__
'1.3.0'
>>> exit()
注意事项
使用Tensorflow一定要激活Tensorflow环境:
$ source activate tensorflow
最后退出当前环境:
$ source deactivate