【问题标题】:No module named '_pywrap_tensorflow' error even after installing Visual C++ and MSVCP140.dll即使在安装 Visual C++ 和 MSVCP140.dll 后也没有名为“_pywrap_tensorflow”的模块错误
【发布时间】:2019-09-05 19:41:03
【问题描述】:

我正在尝试运行 Tensorflow 的简单语音识别网络示例:

python tensorflow/examples/speech_commands/train.py

但我不断得到:

Traceback(最近一次调用最后一次): 文件“C:\Users\DELL 7000\AppData\Local\Programs\Python\Python37-32\lib\site-packages\tensorflow\python\pywrap_tensorflow.py”,第 18 行,在 swig_import_helper fp,路径名,描述 = imp.find_module('_pywrap_tensorflow', [dirname(file)]) 文件“C:\Users\DELL 7000\AppData\Local\Programs\Python\Python37-32\lib\imp.py”,第 296 行,在 find_module 引发 ImportError(_ERR_MSG.format(name), name=name) ImportError:没有名为“_pywrap_tensorflow”的模块

在处理上述异常的过程中,又发生了一个异常:

Traceback(最近一次调用最后一次): 文件“C:\Users\DELL 7000\AppData\Local\Programs\Python\Python37-32\lib\site-packages\tensorflow\python__init__.py”,第 66 行,在 从 tensorflow.python 导入 pywrap_tensorflow 文件“C:\Users\DELL 7000\AppData\Local\Programs\Python\Python37-32\lib\site-packages\tensorflow\python\pywrap_tensorflow.py”,第 28 行,在 _pywrap_tensorflow = swig_import_helper() 文件“C:\Users\DELL 7000\AppData\Local\Programs\Python\Python37-32\lib\site-packages\tensorflow\python\pywrap_tensorflow.py”,第 20 行,在 swig_import_helper 导入 _pywrap_tensorflow ModuleNotFoundError:没有名为“_pywrap_tensorflow”的模块

在处理上述异常的过程中,又发生了一个异常:

Traceback(最近一次调用最后一次): 文件“tensorflow/examples/speech_commands/train.py”,第 79 行,在 将张量流导入为 tf 文件“C:\Users\DELL 7000\AppData\Local\Programs\Python\Python37-32\lib\site-packages\tensorflow__init__.py”,第 24 行,在 从 tensorflow.python 导入 * 文件“C:\Users\DELL 7000\AppData\Local\Programs\Python\Python37-32\lib\site-packages\tensorflow\python__init__.py”,第 72 行,在 引发 ImportError(味精) ImportError: Traceback (最近一次调用最后一次): 文件“C:\Users\DELL 7000\AppData\Local\Programs\Python\Python37-32\lib\site-packages\tensorflow\python\pywrap_tensorflow.py”,第 18 行,在 swig_import_helper fp,路径名,描述 = imp.find_module('_pywrap_tensorflow', [dirname(file)]) 文件“C:\Users\DELL 7000\AppData\Local\Programs\Python\Python37-32\lib\imp.py”,第 296 行,在 find_module 引发 ImportError(_ERR_MSG.format(name), name=name) ImportError:没有名为“_pywrap_tensorflow”的模块

在处理上述异常的过程中,又发生了一个异常:

Traceback(最近一次调用最后一次): 文件“C:\Users\DELL 7000\AppData\Local\Programs\Python\Python37-32\lib\site-packages\tensorflow\python__init__.py”,第 66 行,在 从 tensorflow.python 导入 pywrap_tensorflow 文件“C:\Users\DELL 7000\AppData\Local\Programs\Python\Python37-32\lib\site-packages\tensorflow\python\pywrap_tensorflow.py”,第 28 行,在 _pywrap_tensorflow = swig_import_helper() 文件“C:\Users\DELL 7000\AppData\Local\Programs\Python\Python37-32\lib\site-packages\tensorflow\python\pywrap_tensorflow.py”,第 20 行,在 swig_import_helper 导入 _pywrap_tensorflow ModuleNotFoundError:没有名为“_pywrap_tensorflow”的模块

无法加载原生 TensorFlow 运行时。

https://github.com/tensorflow/tensorflow/blob/master/tensorflow/g3doc/get_started/os_setup.md#import_error

出于一些常见原因和解决方案。包括整个堆栈跟踪 寻求帮助时出现此错误消息。

我发现的大多数解决方案都告诉我重新安装 Visual c++ 或手动将 MSVCP140.dll 添加到路径中。但是这些都不能解决我的问题。

它告诉我参考的 github 页面返回 404。

我使用的是 python 3.7.2 和 tensorflow 1.0.0。

【问题讨论】:

    标签: python python-3.x tensorflow speech-recognition


    【解决方案1】:

    您应该更改 Python 或 Tensorflow 的版本,因为您使用的这两个版本不兼容。您可以降级到 Python3.6 或尝试支持 Python 3.7 的 Tensorflow>=1.13.1。

    【讨论】:

      猜你喜欢
      • 2019-09-29
      • 2019-11-07
      • 1970-01-01
      • 1970-01-01
      • 2023-03-27
      • 1970-01-01
      • 1970-01-01
      • 2021-06-28
      • 1970-01-01
      相关资源
      最近更新 更多