TensorFlow 1.3 GPU 版本不适用于 Windows 7
TensorFlow 1.3 GPU version not working on Windows 7
我是机器学习的初学者,正在尝试使用 Anaconda 设置 TensorFlow python 环境。但是,我一直在处理"No module named "pywrap_tensorflow_internal""
的常见问题
>>> import tensorflow as tf
Traceback (most recent call last):
File "C:\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\pywrap_
tensorflow_internal.py", line 18, in swig_import_helper
return importlib.import_module(mname)
File "C:\Anaconda3\envs\tensorflow\lib\importlib\__init__.py", line 126, in im
port_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 985, in _gcd_import
File "<frozen importlib._bootstrap>", line 968, in _find_and_load
File "<frozen importlib._bootstrap>", line 957, 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 938, 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:\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\pywrap_
tensorflow.py", line 41, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\pywrap_
tensorflow_internal.py", line 21, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\pywrap_
tensorflow_internal.py", line 20, in swig_import_helper
return importlib.import_module('_pywrap_tensorflow_internal')
File "C:\Anaconda3\envs\tensorflow\lib\importlib\__init__.py", line 126, in im
port_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:\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\__init__.py",
line 24, in <module>
from tensorflow.python import *
File "C:\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\__init_
_.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "C:\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\pywrap_
tensorflow.py", line 52, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "C:\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\pywrap_
tensorflow_internal.py", line 18, in swig_import_helper
return importlib.import_module(mname)
File "C:\Anaconda3\envs\tensorflow\lib\importlib\__init__.py", line 126, in im
port_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 985, in _gcd_import
File "<frozen importlib._bootstrap>", line 968, in _find_and_load
File "<frozen importlib._bootstrap>", line 957, 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 938, 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:\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\pywrap_
tensorflow.py", line 41, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\pywrap_
tensorflow_internal.py", line 21, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\pywrap_
tensorflow_internal.py", line 20, in swig_import_helper
return importlib.import_module('_pywrap_tensorflow_internal')
File "C:\Anaconda3\envs\tensorflow\lib\importlib\__init__.py", line 126, in im
port_module
return _bootstrap._gcd_import(name[level:], package, level)
ImportError: No module named '_pywrap_tensorflow_internal'
尽管这与出现的许多其他问题的错误相同,但 none 的解决方案似乎有效。
我已经在我的 %PATH%
中安装并指向了 MSVCP140.DLL
,并且我在 Python 3.5 上 运行 安装了它。我相信问题出在 CUDA 中,因为当我 运行 CPU 版本的 TensorFlow
时不会出现这个问题
但是,我很难弄清楚我的 CUDA 设置有什么问题。我安装了 CUDA 8 和 cuDNN v5.1。 Here is what my CUDA install folder looks like. cuDNN is just the files extracted from the cuDNN zip.
此外,这里是我的相关部分 %PATH%
:
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\cudaNN\bin\cudnn64_5.dll;
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\cudaNN\include\cudnn.h;
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\cudaNN\lib\x64\cudnn.lib;
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\lib;
C:\Windows\System32\msvcp140.dll;
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\lib;
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\extras\CUPTI\libx64;
C:\Windows\SysWOW64\msvcp140.dll;
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA;
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\bin;
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\libnvvp;
我完全不知道我的设置有什么问题,所以非常感谢您的帮助。
如果你安装了GPU版本的TensorFlow 1.3(昨天发布),发布的PIP包需要cuDNN 6。您可以从 NVIDIA's website 安装它。确保包含文件 cudnn64_6.dll
的目录包含在您的 %PATH%
环境变量中。
我是机器学习的初学者,正在尝试使用 Anaconda 设置 TensorFlow python 环境。但是,我一直在处理"No module named "pywrap_tensorflow_internal""
的常见问题>>> import tensorflow as tf
Traceback (most recent call last):
File "C:\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\pywrap_
tensorflow_internal.py", line 18, in swig_import_helper
return importlib.import_module(mname)
File "C:\Anaconda3\envs\tensorflow\lib\importlib\__init__.py", line 126, in im
port_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 985, in _gcd_import
File "<frozen importlib._bootstrap>", line 968, in _find_and_load
File "<frozen importlib._bootstrap>", line 957, 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 938, 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:\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\pywrap_
tensorflow.py", line 41, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\pywrap_
tensorflow_internal.py", line 21, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\pywrap_
tensorflow_internal.py", line 20, in swig_import_helper
return importlib.import_module('_pywrap_tensorflow_internal')
File "C:\Anaconda3\envs\tensorflow\lib\importlib\__init__.py", line 126, in im
port_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:\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\__init__.py",
line 24, in <module>
from tensorflow.python import *
File "C:\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\__init_
_.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "C:\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\pywrap_
tensorflow.py", line 52, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "C:\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\pywrap_
tensorflow_internal.py", line 18, in swig_import_helper
return importlib.import_module(mname)
File "C:\Anaconda3\envs\tensorflow\lib\importlib\__init__.py", line 126, in im
port_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 985, in _gcd_import
File "<frozen importlib._bootstrap>", line 968, in _find_and_load
File "<frozen importlib._bootstrap>", line 957, 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 938, 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:\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\pywrap_
tensorflow.py", line 41, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\pywrap_
tensorflow_internal.py", line 21, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\pywrap_
tensorflow_internal.py", line 20, in swig_import_helper
return importlib.import_module('_pywrap_tensorflow_internal')
File "C:\Anaconda3\envs\tensorflow\lib\importlib\__init__.py", line 126, in im
port_module
return _bootstrap._gcd_import(name[level:], package, level)
ImportError: No module named '_pywrap_tensorflow_internal'
尽管这与出现的许多其他问题的错误相同,但 none 的解决方案似乎有效。
我已经在我的 %PATH%
中安装并指向了 MSVCP140.DLL
,并且我在 Python 3.5 上 运行 安装了它。我相信问题出在 CUDA 中,因为当我 运行 CPU 版本的 TensorFlow
但是,我很难弄清楚我的 CUDA 设置有什么问题。我安装了 CUDA 8 和 cuDNN v5.1。 Here is what my CUDA install folder looks like. cuDNN is just the files extracted from the cuDNN zip.
此外,这里是我的相关部分 %PATH%
:
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\cudaNN\bin\cudnn64_5.dll;
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\cudaNN\include\cudnn.h;
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\cudaNN\lib\x64\cudnn.lib;
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\lib;
C:\Windows\System32\msvcp140.dll;
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\lib;
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\extras\CUPTI\libx64;
C:\Windows\SysWOW64\msvcp140.dll;
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA;
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\bin;
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\libnvvp;
我完全不知道我的设置有什么问题,所以非常感谢您的帮助。
如果你安装了GPU版本的TensorFlow 1.3(昨天发布),发布的PIP包需要cuDNN 6。您可以从 NVIDIA's website 安装它。确保包含文件 cudnn64_6.dll
的目录包含在您的 %PATH%
环境变量中。