导入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的,那运行python test.py
就会报错,必须运行python3 test.py
ImportError: No module named tensorflow