reference : https://www.jianshu.com/p/b7f735930c36
http://blog.csdn.net/u010858605/article/details/64128466
Anaconda 清华镜像:https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/
1、基于 Anaconda 的安装
2、打开shell,添加清华仓库镜像
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --set show_channel_urls yes
3、创建一个python环境
conda create -n tensorflow python=3.6.2
或者通过界面操作
4、启动tensorflow环境
source activate tensorflow
注:当不使用tensorflow时,关闭tensorflow环境,命令为:source deactivate
5、安装cpu版本的TensorFlow
pip install --upgrade --ignore-installed tensorflow
sunMacBook-Pro:~ sun$ source activate tensorflow
(tensorflow) sunBook-Pro:~ sun$ pip install --upgrade --ignore-installed tensorflow
6、测试tensorflow
(tensorflow) sunkMacBook-Pro:~ sun$ python
import tensorflow as tf
hello = tf.constant('Hello, TensorFlow!')
sess = tf.Session()
print(sess.run(hello))
--'Hello, TensorFlow!'
启动Spyder IDE
注意:一定要启动tensorflow 环境下的Spyder才可以import tensorflow,不要去开始菜单运行Spyder,在那里是无法运行的,如
直接安装
reference : https://github.com/tensorflow/tensorflow
$sudo pip install https://ci.tensorflow.org/view/tf-nightly/job/tf-nightly-mac/TF_BUILD_IS_OPT=OPT,TF_BUILD_IS_PIP=PIP,TF_BUILD_PYTHON_VERSION=PYTHON2,label=mac-slave/lastSuccessfulBuild/artifact/pip_test/whl/tf_nightly-1.head-py2-none-any.whl
$ python
...
>>> import tensorflow as tf
>>> hello = tf.constant('Hello, TensorFlow!')
>>> sess = tf.Session()
>>> print(sess.run(hello))
Hello, TensorFlow!
Mac系统10.11及以上升级numpy、scipy等python包报错解决方案
点击Mac电脑的苹果图标
选择 重新启动
按住 command+R,直到进入还原模式
选择实用工具,然后点击 终端
输入 csrutil disable 按下回车
重启电脑
- 点击Mac电脑的苹果图标
- 选择 重新启动
- 按住 command+R,直到进入还原模式
- 选择实用工具,然后点击 终端
- 输入 csrutil enable 按下回车
- 重启电脑