打開命令框,輸入python
pip3 install tensorflow
複製代碼
或更新tensorflow:markdown
pip3 install --upgrade tensorflow
複製代碼
這裏有兩個提示:ide
tensorboard 1.14.0 has requirement setuptools>=41.0.0, but you'll have setuptools 39.0.1 which is incompatible. 解決方法:blog.csdn.net/Charonmomo/…oop
You are using pip version 10.0.1, however version 19.2.1 is available. You should consider upgrading via the 'python -m pip install --upgrade pip' command. 按照提示更新pip版本就行了。測試
python -m pip install --upgrade pip
複製代碼
輸入python或pip顯示是無效命令 緣由: 環境變量中沒有添加python的路徑。ui
解決方法: 在環境變量的系統變量中修改path的值,加入路徑,如:D:\Python37\Scriptsspa
若是添加了仍是不行,能夠直接在命令框中進入python.exe,pip3.exe存在的文件夾中使用python和pip3的功能。.net
輸入:code
pip show tensorflow
複製代碼
或進入python,輸入orm
import tensorflow as tf
hello = tf.constant('hello,world')
sess = tf.Session()
print(sess.run(hello))
複製代碼
簡單的加法測試:
import tensorflow as tf
x=tf.constant(1)
y=tf.constant(2)
z=x+y
sess=tf.Session()
print(sess.run(z))
複製代碼