在Ubuntu上安装TensorFlow

程序包更新

$ sudo apt-get update

确认Python的版本

$ python -V
Python 2.7.9

使用pip进行安装

$ sudo apt-get install python-pip python-dev

安装TensorFlow

# CPUのみ 今回はこっち
$ sudo pip install --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.7.1-cp27-none-linux_x86_64.whl

# GPUはこっち
$ sudo pip install --upgrade https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow-0.7.1-cp27-none-linux_x86_64.whl

在考试中试着运行一下。

$ python

>>> import tensorflow as tf
>>> hello = tf.constant('Hello, TensorFlow!')
>>> sess = tf.Session()
>>> sess.run(hello)
Hello, TensorFlow!
>>> a = tf.constant(10)
>>> b = tf.constant(32)
>>> sess.run(a+b)
42
>>>

动了起来 le qǐ

bannerAds