1.MAC自带了python2.7
2.安装pip
sudo easy_install pip
3.安装
sudo easy_install --upgrade six
sudo pip install --upgrade https://storage.googleapis.com/tensorflow/mac/tensorflow-0.8.0rc0-py2-none-any.whl
4.运行出错
~ python
>>>import tensorflow as tf
报错
RuntimeError: module compiled against API version 0xa but this version of numpy is 0x9
...
解决
- brew install python
- brew tap homebrew/science
- brew install opencv
不管用,继续查询
[http://blog.csdn.net/jiangda_0_0/article/details/52608632]
import numpy
print numpy.__path__
在发生错误的Python环境下执行这两个命令,手动删除旧版本的numpy
直接rm 掉,在运行,ok了。
>>> 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))
参考[http://blog.csdn.net/sydpz1987/article/details/51175359]