Ubuntu14.04默认安装pip和python2.7,pip需要更新
切换到超级管理员
sudo su
安装pip
sudo apt-get install Python-pip python-dev python-setuptools build-essential
更新pip
sudo python -m pip install –upgrade pip
查看版本
pip -V
安装tensorflow1.2.0
# Ubuntu/Linux 64-bit, CPU only:
$ sudo pip install --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.2.0-cp27-none-linux_x86_64.whl
测试
$ 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