import TensorFlow:[WinError 126]找不到指定的模块

时间:2018-03-14 09:37:06

标签: python tensorflow cuda

我想学习使用TensorFlow,当然,我甚至无法安装它!

这些是关于我案例的信息:

  • Python 3.6 64位
  • 英特尔(R)HD Graphics 520
  • Intel i7
  • Windows 7
  • numpy 1.14.1

我已按照以下步骤操作:

  1. 在cmd上:C:\> pip3 install --upgrade tensorflow-gpu
  2. 在Python上:import tensorflow
  3. 但是我收到以下错误:

    Traceback (most recent call last):
      File "C:\Users\VES\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\platform\self_check.py", line 62, in preload_check
        ctypes.WinDLL(build_info.nvcuda_dll_name)
      File "C:\Users\VES\AppData\Local\Programs\Python\Python36\lib\ctypes\__init__.py", line 348, in __init__
        self._handle = _dlopen(self._name, mode)
    OSError: [WinError 126] The specified module could not be found
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "<pyshell#0>", line 1, in <module>
        import tensorflow
      File "C:\Users\VES\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\__init__.py", line 24, in <module>
        from tensorflow.python import *
      File "C:\Users\VES\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\__init__.py", line 49, in <module>
        from tensorflow.python import pywrap_tensorflow
      File "C:\Users\VES\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 30, in <module>
        self_check.preload_check()
      File "C:\Users\VES\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow\python\platform\self_check.py", line 70, in preload_check
        % build_info.nvcuda_dll_name)
    ImportError: Could not find 'nvcuda.dll'. TensorFlow requires that this DLL be installed in a directory that is named in your %PATH% environment variable. Typically it is installed in 'C:\Windows\System32'. If it is not present, ensure that you have a CUDA-capable GPU with the correct driver installed.
    

1 个答案:

答案 0 :(得分:2)

要在GPU支持下运行tensorflow,您需要安装NVIDIA显卡并安装CUDA库(请参阅requirements here),遗憾的是您的 Intel(R)HD Graphics 520 不会做。

您可以选择CPU版本(pip3 install --upgrade tensorflow),这仍然可以开始学习。

更新:另一种解决方案是使用在线服务Google Colab,它允许您从Google的云基础架构借用GPU用于学习目的。

相关问题