我正在尝试在win10上安装tensorflow gpu。我的步骤:
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Python\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 41, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Python\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 21, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Python\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 20, in swig_import_helper
return importlib.import_module('_pywrap_tensorflow_internal')
File "C:\Python\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:\Python\lib\site-packages\tensorflow\__init__.py", line 24, in <module>
from tensorflow.python import *
File "C:\Python\lib\site-packages\tensorflow\python\__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "C:\Python\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 52, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "C:\Python\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 18, in swig_import_helper
return importlib.import_module(mname)
File "C:\Python\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: Не найден указанный модуль.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Python\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 41, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Python\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 21, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Python\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 20, in swig_import_helper
return importlib.import_module('_pywrap_tensorflow_internal')
File "C:\Python\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.
如果我在没有GPU的情况下安装tensorflow-一切正常。
遵循TensorFlow install instructions非常重要,从而选择正确的版本:
- CUDA®Toolkit8.0。有关详细信息,请参阅NVIDIA的文档确保将相关的Cuda路径名附加到%PATH%环境变量,如NVIDIA文档中所述。
- 与CUDA Toolkit 8.0相关的NVIDIA驱动程序。
- cuDNN v6或v6.1。有关详细信息,请参阅NVIDIA的文档。请注意,cuDNN通常安装在与其他CUDA DLL不同的位置。确保将安装cuDNN DLL的目录添加到%PATH%环境变量中。
- 具有CUDA Compute Capability 3.0或更高版本的GPU卡。有关支持的GPU卡列表,请参阅NVIDIA文档。
目前,CUDA Toolkit的最新版本是9.0,但对于Tensorflow,您需要版本8,可在CUDA toolkit archive上找到:https://developer.nvidia.com/cuda-80-ga2-download-archive
对于cuDNN(深度神经网络库),您需要选择cuDNN v6,而不是最新版本的v7:https://developer.nvidia.com/rdp/cudnn-download
最后,确保将Windows %PATH%
变量放入CUDA bin目录(dll库所在的位置)。
然后,您可以安装tensorflow:
pip3 install --upgrade tensorflow-gpu
如果它还不起作用,您可能需要先重新启动。
目前,支持这些版本。不要尝试安装更新的版本。
Visual Studio 2015. CUDA 9.0。 cuDNN 7.0(确保将dll复制到正确的目录)。 Python 3.5。
然后你可以安装tf
这就是我如何解决它,如果你使用pip或pip3,你第一次成功的机会就会减少。
如果您使用的是anaconda,请在anaconda提示符下运行此命令
conda install -c anaconda tensorflow-gpu
这也将为你安装cuda toolkit
和cudnn
你很高兴去网站它提到这个命令是针对linux所以我不确定它是否可以在窗口上工作,但你可以试试