Mac 上搭建TensorFlow环境
2017-11-13 本文已影响0人
逆风g
- 安装HomeBrew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
实际地址以Homebrew主页显示为主 - 安装Python
brew install python
- 安装pip
sudo easy_install pip
sudo easy_install --upgrade six
- 安装tensorflow
$pip install tensorflow
$pip install tensorflow-gpu #GPU support version#
- 测试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