1.安装Anaconda
sudo chmod Anaconda2-5.3.0-Linux-x86_64.sh
./Anaconda2-5.3.0-Linux-x86_64.sh
2.安装tensorflow
- 按照 Anaconda 下载网站上的说明下载并安装 Anaconda。
- 通过调用以下命令创建名为 tensorflow 的 conda 环境,以运行某个版本的 Python:
$ conda create -n tensorflow pip python=2.7 # or python=3.3, etc.
$ source activate tensorflow
(tensorflow)$ # Your prompt should change
- 发出以下格式的命令以在 conda 环境中安装 TensorFlow:
(tensorflow)$ pip install --ignore-installed --upgrade tfBinaryURL
- 其中 tfBinaryURL 是 TensorFlow Python 软件包的网址。例如,以下命令将针对 Python 2.7 安装仅支持 CPU 的 TensorFlow 版本:
(tensorflow)$ pip install --ignore-installed --upgrade https://download.tensorflow.google.cn/linux/cpu/tensorflow-1.8.0-cp27-none-linux_x86_64.whl
3.tensorflow测试
source activate tensorflow
$ python
- 在 Python 交互式 shell 中输入以下几行简短的程序代码:
# Python
import tensorflow as tf
hello = tf.constant('Hello, TensorFlow!')
sess = tf.Session()
print(sess.run(hello))
4.额外的工具包安装
python -m pip install matplotlib
python -m pip install sklearn