Install TensorFlow(V0.11.0) on Mac OSX (Sierra)

About Mac Configuration:
MacPro Retina-2013 Later, OS-Sierra(10.12), python 2.7.10

About TensorFlow:
Version: 0.11.0

Step1: close the System Integrity Protection
Some errors and exceptions are caused by System Integrity Protection of Mac. So first you should close the System Integrity Protection (Restart->press”command+r” after screen become black->open the terminal from top menu->input “csrutil disable” and press return->continue input”shutdown -r now” and press return to restart your Mac)
Tips: you can enable the System Integrity Protection after installing tensorflow to prevent from risk issues.

Step2: Install TensorFlow using Pip
I installed tensorflow as the Pip installation guideline from tensorflow official website.

# Mac OS X
$ sudo easy_install pip
$ sudo easy_install --upgrade six


# Mac OS X, CPU only, Python 2.7:
$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/mac/cpu/tensorflow-0.11.0-py2-none-any.whl

# Python 2
$ sudo pip install --upgrade $TF_BINARY_URL

if you have closed the system integrity protection following Step1 in advance, you should install the tensorflow successfully.

Step3: Test the installation of TensorFlow
Input the test code provided on tensorflow website.

$ python
...
>>> import tensorflow as tf
>>> hello = tf.constant('Hello, TensorFlow!')
>>> sess = tf.Session()
>>> print(sess.run(hello))
Hello, TensorFlow!
>>> a = tf.constant(10)
>>> b = tf.constant(32)
>>> print(sess.run(a + b))
42
>>>

Problems: when I input the “import tensorflow as tf”, the following issues came out:

RuntimeError: module compiled against API version 0xa but this version of numpy is 0x9Traceback (most recent call last):File ““, line 1, in 
........
........

The reason for this problem is that a old version Numpy installed on your Mac, so you can upgrade your Numpy to solve this problem. Input the code below in your terminal:

sudo easy_install --upgrade numpy

After that, you may also need to delete the old version numpy manually from the folder.

After doing these steps above, you should can run the “import tensorflow as tf” without any problems. Just start to enjoy your deep learning.

Related links:
http://targe.me/2016/04/22/tensorflow-intsll-on-mac/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值