发新帖

ImportError: No module named '_pywrap_tensorflow'

[复制链接]
62 5

快来加入 TensorFlowers 大家庭!

您需要 登录 才可以下载或查看,没有帐号?加入社区

x
demo.py文件内容如下:

import tensorflow as tf
print('hello world')

编译时报错
F:\exercise>python demo.py
Traceback (most recent call last):
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 18, in swig_import_helper
    fp, pathname, description = imp.find_module('_pywrap_tensorflow', [dirname(__file__)])
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\imp.py", line 296, in find_module
    raise ImportError(_ERR_MSG.format(name), name=name)
ImportError: No module named '_pywrap_tensorflow'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\__init__.py", line 66, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 28, in <module>
    _pywrap_tensorflow = swig_import_helper()
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 20, in swig_import_helper
    import _pywrap_tensorflow
ModuleNotFoundError: No module named '_pywrap_tensorflow'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "demo.py", line 1, in <module>
    import tensorflow as tf
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\__init__.py", line 24, in <module>
    from tensorflow.python import *
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\__init__.py", line 72, in <module>
    raise ImportError(msg)
ImportError: Traceback (most recent call last):
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 18, in swig_import_helper
    fp, pathname, description = imp.find_module('_pywrap_tensorflow', [dirname(__file__)])
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\imp.py", line 296, in find_module
    raise ImportError(_ERR_MSG.format(name), name=name)
ImportError: No module named '_pywrap_tensorflow'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\__init__.py", line 66, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 28, in <module>
    _pywrap_tensorflow = swig_import_helper()
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 20, in swig_import_helper
    import _pywrap_tensorflow
ModuleNotFoundError: No module named '_pywrap_tensorflow'

Failed to load the native TensorFlow runtime.

See https://github.com/tensorflow/te ... tup.md#import_error

for some common reasons and solutions.  Include the entire stack trace
above this error message when asking for help.

使用Windows10 64位,安装的是python-3.7.1-amd64.exe,怎么才能编通过,先谢谢了


我知道答案 回答被采纳将会获得10 金币 + 5 金币 已有5人回答
本楼点评(0) 收起

精彩评论5

ViolinSolo  TF芽芽  发表于 7 天前 | 显示全部楼层
tf什么版本呀,然后你直接用python cli的那个交互界面 输入
  1. import tensorflow as tf
复制代码
你看看是不是还会报一样的错误呀,,,
本楼点评(1) 收起
hanalan  TF荚荚  发表于 7 天前 | 显示全部楼层
ImportError: No module named '_pywrap_tensorflow'
导入包报错说明你没安装_pywrap_tensorflow这个包
本楼点评(1) 收起
Zongjun  TF荚荚  发表于 6 天前 | 显示全部楼层
这里有一个和你的很相似的问题:链接
重点看一下第一个回答和第二个回答。
本楼点评(0) 收起
您需要登录后才可以回帖 登录 | 加入社区

本版积分规则

快速回复 返回顶部 返回列表