導(dǎo)入tensorflow模塊失敗,
with python2
pip show tensorflow 檢查是否安裝
python test.py 測試
with python3
pip3 show tensorflow 檢查是否安裝
python3 test.py 測試
test.py
import tensorflow as tf
import numpy as np
c = np.array([[3.,4], [5.,6], [6.,7]])
step = tf.reduce_mean(c, 1)
with tf.Session() as sess:
print(sess.run(step))
如果安裝的是tensorflow的模塊是python3的,那運(yùn)行python test.py就會報(bào)錯(cuò),必須運(yùn)行python3 test.py
ImportError: No module named tensorflow