安装tensorflow。
由于我的ubuntu是最新版的(ubuntu-16.04-desktop-amd64),里面自带的python是2.7.12。本文介绍pip安装tensorflow
(1)首先安装pip
sudo apt-get install python-pip python-dev
(2)利用pip安装tensorflow
sudo pip install –upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.1.0-cp27-none-linux_x86_64.whl
( 3)、检验tensorflow是否安装成功
通过下面一段代码来测试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