仅支持 CPU
#使用 Virtualenv 进行安装
sudo apt-get install python3-pip python3-dev python-virtualenv
virtualenv --system-site-packages -p python3 ~/tensorflow
#激活 Virtualenv 环境
source ~/tensorflow/bin/activate
激活后或变成这样子
(tensorflow) as@as-virtual-machine:~$
easy_install -U pip
pip3 install --upgrade tensorflow
验证
# Python
import tensorflow as tf
hello = tf.constant('Hello, TensorFlow!')
sess = tf.Session()
print(sess.run(hello))
如果系统输出以下内容,就说明您可以开始编写 TensorFlow 程序了:
Hello, TensorFlow!