About Mac Configuration：
MacPro Retina-2013 Later, OS-Sierra(10.12), python 2.7.10
Required components: protobuf, numpy, mock, six, wheel
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. You can use the following code to find out where the numpy library is and then delete it. (I recommend you’d better backup this file to avoid some system issues in the future).
import numpyprint numpy.__path__
After doing these steps above, I think you could run the “import tensorflow as tf” without any problems. Just start to enjoy your deep learning.
- 1FFMPEG x264编译
- 2**libaio.so.1: cannot open shared object f
- 3[学习]Linux (sys)Log
- 5linux | 下载文件
- 8html 外边距合并的解决办法
- 10myeclipse中部署复制的java web项目报错：Error