安裝tensorflow
pip install tensorflow==1.13.1 -i https://pypi.tuna.tsinghua.edu.cn/simple
可以在命令行
或者在pycharm的命令行
運行第一個tensorflow代碼
import tensorflow 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程序需要數據集