没有模块命名为'_pywrap_tensorflow_internal'

在尝试validationtensorflow-gpu的安装时,当试图执行“导入tensorflow为tf”时,我得到一个ImportError。 我在Windows 7上使用Quadro K620。使用pip安装Tensorflow。

以下是堆栈跟踪:

Microsoft Windows [Version 6.1.7601] Copyright (c) 2009 Microsoft Corporation. All rights reserved. C:\Users\aagarwal>python Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:18:55) [MSC v.1900 64 bit (AM D64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import tensorflow as tf Traceback (most recent call last): File "C:\Users\aagarwal\AppData\Local\Programs\Python\Python35\lib\site-packag es\tensorflow\python\pywrap_tensorflow_internal.py", line 18, in swig_import_hel per return importlib.import_module(mname) File "C:\Users\aagarwal\AppData\Local\Programs\Python\Python35\lib\importlib\_ _init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 986, in _gcd_import File "<frozen importlib._bootstrap>", line 969, in _find_and_load File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 666, in _load_unlocked File "<frozen importlib._bootstrap>", line 577, in module_from_spec File "<frozen importlib._bootstrap_external>", line 906, in create_module File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed ImportError: DLL load failed: The specified module could not be found. During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\Users\aagarwal\AppData\Local\Programs\Python\Python35\lib\site-packag es\tensorflow\python\pywrap_tensorflow.py", line 41, in <module> from tensorflow.python.pywrap_tensorflow_internal import * File "C:\Users\aagarwal\AppData\Local\Programs\Python\Python35\lib\site-packag es\tensorflow\python\pywrap_tensorflow_internal.py", line 21, in <module> _pywrap_tensorflow_internal = swig_import_helper() File "C:\Users\aagarwal\AppData\Local\Programs\Python\Python35\lib\site-packag es\tensorflow\python\pywrap_tensorflow_internal.py", line 20, in swig_import_hel per return importlib.import_module('_pywrap_tensorflow_internal') File "C:\Users\aagarwal\AppData\Local\Programs\Python\Python35\lib\importlib\_ _init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) ImportError: No module named '_pywrap_tensorflow_internal' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "<stdin>", line 1, in <module> File "C:\Users\aagarwal\AppData\Local\Programs\Python\Python35\lib\site-packag es\tensorflow\__init__.py", line 24, in <module> from tensorflow.python import * File "C:\Users\aagarwal\AppData\Local\Programs\Python\Python35\lib\site-packag es\tensorflow\python\__init__.py", line 51, in <module> from tensorflow.python import pywrap_tensorflow File "C:\Users\aagarwal\AppData\Local\Programs\Python\Python35\lib\site-packag es\tensorflow\python\pywrap_tensorflow.py", line 52, in <module> raise ImportError(msg) ImportError: Traceback (most recent call last): File "C:\Users\aagarwal\AppData\Local\Programs\Python\Python35\lib\site-packag es\tensorflow\python\pywrap_tensorflow_internal.py", line 18, in swig_import_hel per return importlib.import_module(mname) File "C:\Users\aagarwal\AppData\Local\Programs\Python\Python35\lib\importlib\_ _init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 986, in _gcd_import File "<frozen importlib._bootstrap>", line 969, in _find_and_load File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 666, in _load_unlocked File "<frozen importlib._bootstrap>", line 577, in module_from_spec File "<frozen importlib._bootstrap_external>", line 906, in create_module File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed ImportError: DLL load failed: The specified module could not be found. During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\Users\aagarwal\AppData\Local\Programs\Python\Python35\lib\site-packag es\tensorflow\python\pywrap_tensorflow.py", line 41, in <module> from tensorflow.python.pywrap_tensorflow_internal import * File "C:\Users\aagarwal\AppData\Local\Programs\Python\Python35\lib\site-packag es\tensorflow\python\pywrap_tensorflow_internal.py", line 21, in <module> _pywrap_tensorflow_internal = swig_import_helper() File "C:\Users\aagarwal\AppData\Local\Programs\Python\Python35\lib\site-packag es\tensorflow\python\pywrap_tensorflow_internal.py", line 20, in swig_import_hel per return importlib.import_module('_pywrap_tensorflow_internal') File "C:\Users\aagarwal\AppData\Local\Programs\Python\Python35\lib\importlib\_ _init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) ImportError: No module named '_pywrap_tensorflow_internal' Failed to load the native TensorFlow runtime. See https://www.tensorflow.org/install/install_sources#common_installation_probl ems for some common reasons and solutions. Include the entire stack trace above this error message when asking for help. >>> 

我已经看了多个其他堆栈溢出post,如纠正path,但我一直无法解决这个问题。

Solutions Collecting From Web of "没有模块命名为'_pywrap_tensorflow_internal'"

今天我遇到了同样的问题,请改为cuDNN v5.1 Library for Windows,而不是@mickdelaney建议,然后尝试

  1. 检查CUDA的环境设置,通常CUDA的所有设置都已添加到Windows环境中

  2. binlib和cuDNN include的文件分别复制到CUDA的binlibinclude 。 通常这个目录是C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA

然后你可以导入tensorflow并运行你的代码。 祝你好运!

安装CUDA驱动程序后,您必须下载cuDNN并将其发布。 之后,您将复制cudnn64_5.dll到PATH。
如果这不起作用,请将cudnn64_5.dll移动到NVIDIA GPU Computing Toolkit\CUDA\v8.0\bin cudnn64_5.dll试。 否则,你会遇到一些你看到的错误。

安装cuDNN 5.1后,我仍然遇到这个错误(是的,我正确设置了PATH)。 我从这个网站安装tensorflow_gpu的好运气。 这需要cuDNN 6.0,而不是5.1。 不幸的是,他们目前只有GPU系统的Tensorflow 1.1。

我是中国人,所以我的英文是pool,而我的答案是,无论使用cudnn 7还是6 or 5,在复制文件之后,必须将cudnn64_x.dll中的dll重命名为cudnn64_6.dll。 也许很快,你需要将dll重命名为7或8或9。

算了,写点中文吧,我特么就不明直了为啥tf导入dll一定要用cudnn64_6?难道不能直接写成cudnn64或者cudnn?反正现在cudnn 7也出来了,难道以后用最新的库都要改名字?