linux下安装TensorFlow及测试

Python 2.7
// CPU版本
pip install https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.4.0-cp27-none-linux_x86_64.whl

// GPU版本
pip install https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.4.0-cp27-none-linux_x86_64.whl

如有错误
用 pip --user install

测试安装是否成功

编写python脚本 test.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))

运行 python test.py 显示Hello,TensorFlow!即可

你可能感兴趣的:(tensorflow)