【问题标题】:ImportError: Could not find 'cudnn64_7.dll'ImportError:找不到“cudnn64_7.dll”
【发布时间】:2019-01-20 07:05:25
【问题描述】:

我遇到以下错误:

 Traceback (most recent call last):   File
 "C:\Anaconda\envs\tensorflow\lib\site-packages\tensorflow\python\platform\self_check.py",
 line 87, in preload_check
     ctypes.WinDLL(build_info.cudnn_dll_name)   File "C:\Anaconda\envs\tensorflow\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 "<stdin    ", line 1, in
 <module       File
 "C:\Anaconda\envs\tensorflow\lib\site-packages\tensorflow\__init__.py",
 line 22, in <module    
     from tensorflow.python import pywrap_tensorflow  # pylint: disable=unused-import   File
 "C:\Anaconda\envs\tensorflow\lib\site-packages\tensorflow\python\__init__.py",
 line 49, in <module    
     from tensorflow.python import pywrap_tensorflow   File "C:\Anaconda\envs\tensorflow\lib\site-packages\tensorflow\python\pywrap_tensorflow.py",
 line 30, in <module    
     self_check.preload_check()   File "C:\Anaconda\envs\tensorflow\lib\site-packages\tensorflow\python\platform\self_check.py",
 line 97, in preload_check
     % (build_info.cudnn_dll_name, build_info.cudnn_version_number)) ImportError: Could not find 'cudnn64_7.dll'. TensorFlow requires that
 this DLL be installed in a directory that is named in your %PATH%
 environment variable. Note that installing cuDNN is a separate step
 from installing CUDA, and this DLL is often found in a different
 directory from the CUDA DLLs. You may install the necessary DLL by
 downloading cuDNN 7 from this URL: https://developer.nvidia.com/cudnn

我已经在%Path%环境中提到的目录中安装了所需的“cuDNN 7”文件,但是声明

import tensorflow as tf

不工作。我已经从上述站点下载了 cuDNN 7 文件:

https://developer.nvidia.com/cudnn

我已经查看了 StackOverflow 上的所有答案,但我遇到了同样的错误。 请指导我如何运行上述语句。

【问题讨论】:

    标签: python tensorflow anaconda cudnn


    【解决方案1】:

    对我来说,是我没有安装 cuDNN。 根据你的cuda版本下载并解压到cuda目录中

    【讨论】:

      【解决方案2】:

      这就是我所做的。

      第 1 步)在我的计算机上安装“NVIDIA GEFORCE EXPERIENCE”以检查我的驱动程序版本。

      第 2 步)驱动程序版本是旧版本。更新可用。所以我更新了我的图形驱动程序。

      我的 GPU 属性现在是:-

      NVIDIA GEFORCE EXPERIENCE Version 3.14.1.48
      GeForce 940MX
      Driver Version 398.82
      Intel(R) Core(TM) i5-7200U CPU @2.50GHz
      7.9 GB RAM
      

      现在,通过 conda 环境(我创建了一个名为 'tensorflow' 的环境),当我执行语句时

      (tensorflow) C:\Users\Arnab Sinha>pip install --ignore-installed --upgrade tensorflow-gpu
      

      我遇到了以下消息:-

      pandas 0.23.4 requires python-dateutil>=2.5.0, which is not installed.
      
      pandas 0.23.4 requires pytz>=2011k, which is not installed.
      

      然后我通过一个接一个地执行以下命令来安装所需的包

      pip install python-dateutil
      

      pip install pytz
      

      之后我在 Python 3.6.6 中运行了该命令

      import tensorflow as tf
      

      然后

      print(tf.__version__)
      

      它给出了输出

      1.10.0
      

      这是我将 Tensorflow 1.10.0 安装到我的计算机中的方法。然而,Anaconda Navigator 没有更新 Tensorflow 1.10.0。如果您找到了它的更新,请通知我。

      【讨论】:

        【解决方案3】:

        第 1 步。 根据此处列出的 Tensorflow 版本安装缺少的 CUDNN 文件:

        https://www.tensorflow.org/install/source_windows

        第 2 步:tf.test.gpu_device_name() 应该输出类似

        /device:GPU:0
        

        如果您在第 2 步中遇到错误,那么您需要具备以下条件:

        • Tensorflow_gpu-2.3.0
        • Python 版本(至少)3.5-3.8
        • MSVC 2019
        • 巴泽尔 3.1.0
        • CUDNN v7.6
        • CUDA 10.1

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 2019-12-22
          • 1970-01-01
          • 2018-11-19
          • 2020-04-16
          • 2020-12-04
          • 2018-07-22
          • 2016-08-19
          相关资源
          最近更新 更多