安装tensorflow
pip install tensorflow==1.13.1 -i https://pypi.tuna.tsinghua.edu.cn/simple
可以在命令行
或者在pycharm的命令行
运行第一个tensorflow代码
importtensorflow as tf#import os#os.environ['TF_CPP_MIN_LOG_LEVEL']='2'
hello = tf.constant('Hello, TensorFlow!')
sess=tf.Session()print(sess.run(hello))
显示结果:
如果报错了,可能是numpy包的问题,因为旧版本的tensorflow不支持较高版本的numpy包,将numpy包降级即可
pip install numpy==1.16.0
一些tensorflow程序需要数据集
将需要的数据集放到你要运行程序的项目下