1.安装HomeBrew--Mac包管理工具
$/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
2.安装Python和pip
可以选择用brew安装Python和pip,也可以直接安装anaconda
2.1 anaconda
2.2用homebrew安装最新的python 2.7.x
$brew install python
安装python2.7.13
如果要安装 python3.x , $brew install python3
安装pip--Python包管理工具
sudo easy_install pip
sudo easy_install --upgrade six
3.安装tensorflow --作为Python软件包
$pip install tensorflow
$pip install tensorflow-gpu #GPU support version#
4. 测试 tensorflow
$ 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
>>>
>>>tf.__version__
>>>tf.__path__
查看tf版本号,和安装位置。
1
2
3
4
|
>>> tf.__version__
'1.0.1'
>>> tf.__path__
[
'/usr/local/lib/python2.7/site-packages/tensorflow'
]
|
运行demo 模型
5.安装 keras
$pip install keras
将安装 keras theano scipy等
参考
https://www.tensorflow.org/versions/r0.12/get_started/index.html
http://www.jianshu.com/nb/6741332
http://www.cnblogs.com/denny402/category/879083.html
http://blog.youkuaiyun.com/sydpz1987/article/category/6188806
http://www.cnblogs.com/GrantYu/p/6607514.html