Tensorflow GPU安装错误Windows 10 Anaconda
Tensorflow GPU installation Error Windows 10 Anaconda
我在尝试为 GPU 使用设置 Tensorflow 时遇到了困难。我不是Windows10,已经下载了CUDA® Toolkit 8.0,cuDNN v5.1。并按照 On Windows, running "import tensorflow" generates No module named "_pywrap_tensorflow" error 的建议卸载并重新安装了 Visual C++ 2015 可再发行版,但这没有任何效果。我也不太确定 PATH 或那里是否正确包含所有内容。这是我不断收到的错误(抱歉,它没有被正确引用,但我一直收到格式错误):
Microsoft Windows [Version 10.0.14393] (c) 2016 Microsoft Corporation.
All rights reserved.
C:\Users\Austin>activate test_env
(test_env) C:\Users\Austin>python
Python 3.5.3 | packaged by
conda-forge | (default, Feb 9 2017, 15:12:38) [MSC v.1900 64 bit
(AMD64)] on win32 Type "help", "copyright", "credits" or "license" for
more information.
>>> import tensorflow as tf
Traceback (most recent call last): File
"C:\Anaconda3\envs\test_env\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py",
line 18, in swig_import_helper return importlib.import_module(mname)
File "C:\Anaconda3\envs\test_env\lib\importlib__init__.py", line 126,
in import_module return _bootstrap._gcd_import(name[level:], package,
level) File "", line 986, in _gcd_import
File "", line 969, in _find_and_load File
"", line 958, in _find_and_load_unlocked
File "", line 666, in _load_unlocked File
"", line 577, in module_from_spec File
"", line 914, in create_module
File "", 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\test_env\lib\site-packages\tensorflow\python\pywrap_tensorflow.py",
line 41, in from tensorflow.python.pywrap_tensorflow_internal
import * File
"C:\Anaconda3\envs\test_env\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py",
line 21, in
_pywrap_tensorflow_internal = swig_import_helper() File "C:\Anaconda3\envs\test_env\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\test_env\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 "", line 1, in
File
"C:\Anaconda3\envs\test_env\lib\site-packages\tensorflow__init__.py",
line 24, in from tensorflow.python import * File
"C:\Anaconda3\envs\test_env\lib\site-packages\tensorflow\python__init__.py",
line 51, in from tensorflow.python import pywrap_tensorflow
File
"C:\Anaconda3\envs\test_env\lib\site-packages\tensorflow\python\pywrap_tensorflow.py",
line 52, in raise ImportError(msg) ImportError: Traceback
(most recent call last): File
"C:\Anaconda3\envs\test_env\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py",
line 18, in swig_import_helper return importlib.import_module(mname)
File "C:\Anaconda3\envs\test_env\lib\importlib__init__.py", line 126,
in import_module return _bootstrap._gcd_import(name[level:], package,
level) File "", line 986, in _gcd_import
File "", line 969, in _find_and_load File
"", line 958, in _find_and_load_unlocked
File "", line 666, in _load_unlocked File
"", line 577, in module_from_spec File
"", line 914, in create_module
File "", 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\test_env\lib\site-packages\tensorflow\python\pywrap_tensorflow.py",
line 41, in from tensorflow.python.pywrap_tensorflow_internal
import * File
"C:\Anaconda3\envs\test_env\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py",
line 21, in
_pywrap_tensorflow_internal = swig_import_helper() File "C:\Anaconda3\envs\test_env\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\test_env\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_problems
for some common reasons and solutions. Include the entire stack trace
above this error message when asking for help.
>>>
这就是我得到的 PATH(我认为这是问题所在,但我真的不太了解 PATH 甚至是什么...)
(test_env) C:\Users\Austin>PATH
PATH=C:\Anaconda3\envs\test_env;C:\Anaconda3\envs\test_env\Library\mingw-w64\bin;C:\Anaconda3\envs\test_env\Library\usr\bin;C:\Anaconda3\envs\test_env\Library\bin;C:\Anaconda3\envs\test_env\Scripts;C:\Program
Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\bin;C:\Program
Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\libnvvp;C:\Program Files
(x86)\Tesseract-OCR;C:\Anaconda3;C:\Anaconda3\Scripts;C:\Program
Files\NVIDIA GPU Computing
Toolkit\cudnn-8.0-windows10-x64-v5.1\cuda;C:\Program Files\Common
Files\microsoft
shared\ClickToRun;C:\Users\Austin\AppData\Local\Microsoft\WindowsApps;C:\Users\Austin\AppData\Local\atom\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;
(test_env) C:\Users\Austin>
想通了。需要将下载的cudnn的内容复制到CUDA文件夹内的相应位置(即lib、bin等)
我在尝试为 GPU 使用设置 Tensorflow 时遇到了困难。我不是Windows10,已经下载了CUDA® Toolkit 8.0,cuDNN v5.1。并按照 On Windows, running "import tensorflow" generates No module named "_pywrap_tensorflow" error 的建议卸载并重新安装了 Visual C++ 2015 可再发行版,但这没有任何效果。我也不太确定 PATH 或那里是否正确包含所有内容。这是我不断收到的错误(抱歉,它没有被正确引用,但我一直收到格式错误):
Microsoft Windows [Version 10.0.14393] (c) 2016 Microsoft Corporation. All rights reserved.
C:\Users\Austin>activate test_env
(test_env) C:\Users\Austin>python
Python 3.5.3 | packaged by conda-forge | (default, Feb 9 2017, 15:12:38) [MSC v.1900 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
Traceback (most recent call last): File "C:\Anaconda3\envs\test_env\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 18, in swig_import_helper return importlib.import_module(mname) File "C:\Anaconda3\envs\test_env\lib\importlib__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 986, in _gcd_import File "", line 969, in _find_and_load File "", line 958, in _find_and_load_unlocked File "", line 666, in _load_unlocked File "", line 577, in module_from_spec File "", line 914, in create_module File "", 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\test_env\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 41, in from tensorflow.python.pywrap_tensorflow_internal import * File "C:\Anaconda3\envs\test_env\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 21, in _pywrap_tensorflow_internal = swig_import_helper() File "C:\Anaconda3\envs\test_env\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\test_env\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 "", line 1, in File "C:\Anaconda3\envs\test_env\lib\site-packages\tensorflow__init__.py", line 24, in from tensorflow.python import * File "C:\Anaconda3\envs\test_env\lib\site-packages\tensorflow\python__init__.py", line 51, in from tensorflow.python import pywrap_tensorflow File "C:\Anaconda3\envs\test_env\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 52, in raise ImportError(msg) ImportError: Traceback (most recent call last): File "C:\Anaconda3\envs\test_env\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 18, in swig_import_helper return importlib.import_module(mname) File "C:\Anaconda3\envs\test_env\lib\importlib__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 986, in _gcd_import File "", line 969, in _find_and_load File "", line 958, in _find_and_load_unlocked File "", line 666, in _load_unlocked File "", line 577, in module_from_spec File "", line 914, in create_module File "", 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\test_env\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 41, in from tensorflow.python.pywrap_tensorflow_internal import * File "C:\Anaconda3\envs\test_env\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 21, in _pywrap_tensorflow_internal = swig_import_helper() File "C:\Anaconda3\envs\test_env\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\test_env\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_problems
for some common reasons and solutions. Include the entire stack trace above this error message when asking for help.
>>>
这就是我得到的 PATH(我认为这是问题所在,但我真的不太了解 PATH 甚至是什么...)
(test_env) C:\Users\Austin>PATH PATH=C:\Anaconda3\envs\test_env;C:\Anaconda3\envs\test_env\Library\mingw-w64\bin;C:\Anaconda3\envs\test_env\Library\usr\bin;C:\Anaconda3\envs\test_env\Library\bin;C:\Anaconda3\envs\test_env\Scripts;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\bin;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\libnvvp;C:\Program Files (x86)\Tesseract-OCR;C:\Anaconda3;C:\Anaconda3\Scripts;C:\Program Files\NVIDIA GPU Computing Toolkit\cudnn-8.0-windows10-x64-v5.1\cuda;C:\Program Files\Common Files\microsoft shared\ClickToRun;C:\Users\Austin\AppData\Local\Microsoft\WindowsApps;C:\Users\Austin\AppData\Local\atom\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;
(test_env) C:\Users\Austin>
想通了。需要将下载的cudnn的内容复制到CUDA文件夹内的相应位置(即lib、bin等)