本文介绍了(Tensorflow-GPU) 导入 tensorflow ImportError: 找不到 'cudnn64_7.dll'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在anaconda下创建tensorflow环境后,我安装了tensorflow-gpu.然后我试图导入 tensorflow 以验证它是否正确安装,但出现此错误:

After created tensorflow environment under anaconda, I installed tensorflow-gpu. Then I was trying to import tensorflow to verify if it's correctly installed, but got this error:

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

设置是:

NVIDIA GTX 1080
CUDA 9.0
cuDNN 6.0
tensorflow-gpu 1.5

环境变量是:

CUDA_PAT: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0
CUDA_PATH_V9_0: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0

%Path% 变量是:

The %Path% variables are:

C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\bin
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\lib\x64
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\libnvvp
C:\Users\yshen\AppData\Local\cudnn-8.0-windows10-x64-v6.0\cuda\bin

很明显我安装了cuDNN6.0,不知道为什么错误显示找不到'cudnn64_7.dll'".为什么会自动搜索cudnn64_7.dll而不是cudnn64_6.dll?

it is obvious that I installed cuDNN6.0, don't why the error shows "Could not find 'cudnn64_7.dll' ". Why it automatically searches cudnn64_7.dll instead of cudnn64_6.dll?

推荐答案

此外,我在安装 TensorFlow 1.8 时遇到以下错误.我有 Anaconda 环境.

Also, I got below error when I installed TensorFlow 1.8. I have the Anaconda environment.

导入错误:找不到‘cudnn64_7.dll’"

但是在我安装 Nvidia cuDNN v7.1.3(2018 年 4 月 17 日)之后,对于 CUDA 9.0,一切都开始工作了.请注意,需要注册为 Nvidia 开发人员才能下载安装包.

But after I installed Nvidia cuDNN v7.1.3 (April 17, 2018), for CUDA 9.0, everything started to work.Please note that one needs to sign up as a Nvidia developer to be able to download the installation package(s).

然后,只需按照页面中的说明进行操作:cudnn-install

Then, just follow the instructions in the page : cudnn-install

对于 Windows:

For Windows:

3.3.在 Windows 上安装 cuDNN

3.3. Installing cuDNN on Windows

以下步骤描述了如何构建依赖于 cuDNN 的程序.在以下部分中:

The following steps describe how to build a cuDNN dependent program. In the following sections:

-您的 CUDA 目录路径称为 C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0

-your CUDA directory path is referred to as C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0

-您的 cuDNN 目录路径称为

-your cuDNN directory path is referred to as <installpath>

  1. 导航到包含 cuDNN 目录.

解压 cuDNN 包.-cudnn-9.0-windows7-x64-v7.zip-cudnn-9.0-windows10-x64-v7.zip

Unzip the cuDNN package. -cudnn-9.0-windows7-x64-v7.zip or -cudnn-9.0-windows10-x64-v7.zip

将以下文件复制到 CUDA Toolkit 目录中.

Copy the following files into the CUDA Toolkit directory.

  • \cuda\bin\cudnn64_7.dll 复制到C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\bin.
  • \cuda\include\cudnn.h 复制到 C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\include.
  • 复制\cuda\lib\x64\cudnn.libC:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\lib\x64.
  • Copy <installpath>\cuda\bin\cudnn64_7.dll to C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\bin.
  • Copy <installpath>\cuda\ include\cudnn.h to C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\include.
  • Copy <installpath>\cuda\lib\x64\cudnn.lib to C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\lib\x64.

设置以下环境变量以指向 cuDNN 所在的位置.要访问 $(CUDA_PATH) 环境变量的值,请执行以下步骤:

Set the following environment variables to point to where cuDNN is located. To access the value of the $(CUDA_PATH) environment variable, perform the following steps:

  • 从开始"菜单打开命令提示符.
  • 输入 Run 并按 .
  • 发出控制 sysdm.cpl 命令.
  • 选择窗口顶部的高级"选项卡.
  • 点击窗口底部的环境变量.
  • 确保设置了以下值:变量名称:CUDA_PATH变量值:C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0
  • Open a command prompt from the Start menu.
  • Type Run and hit .
  • Issue the control sysdm.cpl command.
  • Select the Advanced tab at the top of the window.
  • Click Environment Variables at the bottom of the window.
  • Ensure the following values are set:Variable Name: CUDA_PATH Variable Value: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0

在您的 Visual Studio 项目中包含 cudnn.lib.

Include cudnn.lib in your Visual Studio project.

  • 打开 Visual Studio 项目并右键单击项目名称.
  • 点击链接器>输入 >附加依赖项.
  • 添加cudnn.lib,然后点击.
  • Open the Visual Studio project and right-click on the project name.
  • Click Linker > Input > Additional Dependencies.
  • Add cudnn.lib and click .

这篇关于(Tensorflow-GPU) 导入 tensorflow ImportError: 找不到 'cudnn64_7.dll'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-21 22:41