美文网首页Tensorflow
TensorFlow学习笔记(2)ImportError: No

TensorFlow学习笔记(2)ImportError: No

作者: 谢昆明 | 来源:发表于2018-11-09 09:17 被阅读0次

导入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

相关文章

网友评论

    本文标题:TensorFlow学习笔记(2)ImportError: No

    本文链接:https://www.haomeiwen.com/subject/exlnxqtx.html