在Ubuntu上使用TensorFlow

在AWS上使用Ubuntu进行操作。

    AMI ubuntu/images/hvm-ssd/ubuntu-trusty-14.04-amd64-server-20160114.5 (ami-06116566)

虽然有很多安装方法,但我想尝试使用Anaconda进行安装。

    https://www.tensorflow.org/versions/r0.8/get_started/os_setup.html#requirements

安装Anaconda。

$ wget http://repo.continuum.io/archive/Anaconda3-4.0.0-Linux-x86_64.sh
$ bash Anaconda3-4.0.0-Linux-x86_64.sh 
exec $SHELL

$ conda -V
conda 4.0.5

建立Python 2.7环境。不知为何使用3.5版本时会出现错误。


$ conda create -n tensorflow python=2.7

$ source activate tensorflow

$ python -V
Python 2.7.11 :: Continuum Analytics, Inc.

$ pip -V
pip 8.1.1 from /home/ubuntu/anaconda3/envs/tensorflow/lib/python2.7/site-packages (python 2.7)

之后出现了某种地区设置错误,我会先解决掉。

$ locale
$ export LC_ALL=C

终于到了TensorFlow安装的时候。

$ pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-0.8.0-cp27-none-linux_x86_64.whl

$ python
>>> import tensorflow as tf

请执行这段代码来进行介绍。

    https://www.tensorflow.org/versions/r0.8/get_started/index.html