已安装Tensorflow但在Windows 10中无法运行

时间:2018-05-20 17:06:18

标签: python tensorflow

我安装了Error 25: Expected: ;. Line 202 -> let vis = artboard.visible; 验证的tensorflow 1.8.0:

pip show tensorflow

但是当我尝试测试名为PS C:\> pip show tensorflow Name: tensorflow Version: 1.8.0 Summary: TensorFlow helps the tensors flow Home-page: https://www.tensorflow.org/ Author: Google Inc. Author-email: opensource@google.com License: Apache 2.0 Location: c:\program files (x86)\python36-32\lib\site-packages Requires: tensorboard, grpcio, absl-py, astor, wheel, protobuf, numpy, six, gast, termcolor Required-by: PS C:\> 的简单程序时:

tensorflow.py

我收到了一个错误:

import tensorflow as tf
hello = tf.constant('Hello, TensorFlow!')
sess = tf.Session()
print(sess.run(hello))

我在Windows Power Shell中运行该命令。我的操作系统是带有Python 3.6.5的64位Windows 10。有人可以提出解决方案吗?

1 个答案:

答案 0 :(得分:2)

您的文件名为tensorflow.py,导致它隐藏tensorflow模块。当Python查找tensorflow.constant时,它会尝试在文件中找到它的定义

将您的文件重命名为其他内容。像hello_tf.py这样的东西可能是个不错的选择。