首页 文章

安装tensorflow GPU

提问于
浏览 544
0

我正在尝试在win10上安装tensorflow gpu . 我的步骤:

  • 安装Python 3.5.2

  • 安装Nvidia CUDA(v9)cudnn

  • 复制prog.files目录下的cudnn文件NVIDIA GPU Computing Toolkit

  • 安装tensorflow gpu(pip3 install --upgrade tensorflow-gpu)

C:\ Python> python Python 3.5.2(v3.5.2:4def2a2901a5,2016年6月25日,22:18:55)[MSC v.1900 64 bit(AMD64)]在win32上输入“help”,“copyright”,“信用“或”许可证“了解更多信息 .

import tensorflow as tf Traceback(最近一次调用最后一次):文件“C:\ Python \ lib \ site-packages \ tensorflow \ python \ pywrap_tensorflow_internal.py”,第18行,在swig_import_helper中返回importlib.import_module(mname)文件“C :\ Python \ lib \ importlib__init __ . py“,第126行,在import_module中返回_bootstrap._gcd_import(name [level:],package,level)文件”“,第986行,在_gcd_import文件”“,第969行,在_find_and_load文件中“”,第958行,_find_and_load_unlocked文件“”,第666行,在_load_unlocked文件“”,第577行,在module_from_spec文件“”,第906行,在create_module文件“”,第222行,在_call_with_frames_removed中ImportError:DLL加载失败: Ненайденуказанныймодуль .

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-一切正常 .

3 回答

  • 2

    遵循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
    

    如果它还不起作用,您可能需要先重新启动 .

  • 0

    目前,支持这些版本 . 不要尝试安装更新的版本 .

    Visual Studio 2015. CUDA 9.0 . cuDNN 7.0(确保将dll复制到正确的目录) . Python 3.5 .

    然后你可以安装tf

  • -1

    如果您使用的是anaconda,请在anaconda提示符下运行此命令

    conda install -c anaconda tensorflow-gpu

    这也将为你安装 cuda toolkitcudnn 你很高兴去网站它提到这个命令是针对linux的,所以我不确定它是否可以在窗口上运行,但是你可以试试

相关问题