TensorFlow 的Mac OS 下的部署和安装


TensorFlow 于 2016.4.13 日发布了带有分布式属性的0.8版本, 其很有可能成为继Mapreduce之后又一个改变互联网格局的项目。这个周末一直在家研究TensorFlow 相关的东西,并在Mac OS X下对其进行了部署和安装。

其安装方法非常简单, 参考文档如下 Tensor Flow 安装教程 

$ sudo easy_install pip
$ sudo easy_install --upgrade six
$ sudo pip install --upgrade https://storage.googleapis.com/tensorflow/mac/tensorflow-0.8.0rc0-py2-none-any.whl</a>

安装完成后,即可运行其测试用例

$ 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
>>>
需要注意的是 在 Mac OS 下准备运行MNIST 时有一个关于numpy的报错,

module compiled against API version 0xa but this version of numpy is 0x9
产生该错误的主要原因是由于numpy版本过老导致的,修复方法为通过homebrew安装opencv即可

brew install python
brew tap homebrew/science
brew install opencv

本文永久更新链接地址

相关内容