Win10安装Python版TensorFlow及Hello程序

安装TensorFlow

Python版本3.8

在Win10的Windows PowerShell中,执行命令

python -m pip install tensorflow (下载速度太慢,所以使用下面命令)

python -m pip install -i http://mirrors.aliyun.com/pypi/simple --trusted-host mirrors.aliyun.com tensorflow

 

Win10安装Python版TensorFlow及Hello程序

Hello world程序

import tensorflow as tf

tf.compat.v1.disable_eager_execution()
hello=tf.constant('Hello,TensorFlow')
config=tf.compat.v1.ConfigProto()
sess=tf.compat.v1.Session()

print(sess.run(hello))

Win10安装Python版TensorFlow及Hello程序