python里nomodulenamed_tensorFlow解决问题ImportError: No module named 'tensorflow.python.pywrap_tensorflow...

环境64位机win7旗舰sp1

Pycharm Community Edition 2017.2

tensorFlow1.4.0

报错ImportError: No module named 'tensorflow.python.pywrap_tensorflow_internal'

详情"C:\Program Files\Anaconda3\python.exe" C:/tensorflow-1.1.0/tensorflow/examples/tutorials/mnist/mnist_softmax.py C:\tensorflow-1.1.0\tensorflow\examples\tutorials\mnist\input_data

Traceback (most recent call last):

File "C:\tensorflow-1.1.0\tensorflow\python\pywrap_tensorflow.py", line 41, in

from tensorflow.python.pywrap_tensorflow_internal import *

ImportError: No module named 'tensorflow.python.pywrap_tensorflow_internal'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File "C:/tensorflow-1.1.0/tensorflow/examples/tutorials/mnist/mnist_softmax.py", line 28, in

from tensorflow.examples.tutorials.mnist import input_data

File "C:\tensorflow-1.1.0\tensorflow\__init__.py", line 24, in

from tensorflow.python import *

File "C:\tensorflow-1.1.0\tensorflow\python\__init__.py", line 51, in

from tensorflow.python import pywrap_tensorflow

File "C:\tensorflow-1.1.0\tensorflow\python\pywrap_tensorflow.py", line 52, in

raise ImportError(msg)

ImportError: Traceback (most recent call last):

File "C:\tensorflow-1.1.0\tensorflow\python\pywrap_tensorflow.py", line 41, in

from tensorflow.python.pywrap_tensorflow_internal import *

ImportError: No module named 'tensorflow.python.pywrap_tensorflow_internal'

Failed to load the native TensorFlow runtime.

See https://www.tensorflow.org/install/install_sources#common_installation_problems for some common reasons and solutions. Include the entire stack trace

above this error message when asking for help.

Process finished with exit code 1

原因1.pycharm导入了tensorflow-1.1.0,执行mnist_softmax.py文件时,由于

python误以为tensorflow目录中的tensorflow就是要导入的模块。

解决办法,不要在tensorflow中运行python或者ipython

可以在cmd中运行,但不要在tensorFlow同一目录下执行python命令。

C:\>python C:\tensorflow-1.1.0\tensorflow\examples\tutorials\mnist\mnist_softmax_xla.py

Extracting /tmp/tensorflow/mnist/input_data\train-images-idx3-ubyte.gz

Extracting /tmp/tensorflow/mnist/input_data\train-labels-idx1-ubyte.gz

Extracting /tmp/tensorflow/mnist/input_data\t10k-images-idx3-ubyte.gz

Extracting /tmp/tensorflow/mnist/input_data\t10k-labels-idx1-ubyte.gz

2017-11-12 11:19:49.709578: I C:\tf_jenkins\home\workspace\rel-win\M\windows\PY\35\tensorflow\core\platform\cpu_feature_guard.cc:137] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX

0.9207

2.编译环境问题

windows cpu版, tensorflow安装后,在Python环境下“import tensorflow”时出现上述错误。

解决办法: install the Visual C++ Redistributable 2015 x64 as MSVCP140.DLL may be missing in your system.

Visual C++ Redistributable 2015 x64下载地址:

链接:http://pan.baidu.com/s/1jH9ItTW  密码:0pmq

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值