安装python3(本人安装的是p3环境是Ubuntu16.04)
sudo apt install python3-pip
安装tensorflow
sudo pip3 install tensorflow
安装结束后验证,创建一个文件hello_tensor.py,输入内容如下
import tensorflow as tf
hello = tf.constant('Hello, TensorFlow!')
sess = tf.Session()
print(sess.run(hello))
a = tf.constant(10)
b = tf.constant(32)
print(sess.run(a+b))
然后命令行键入:
python3 hello_tensor.py