且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

导入错误:DLL 加载失败:找不到指定的模块.在尝试导入 TensorFlow 时

更新时间:2021-08-14 10:07:12

我在 Windows 10 和 GTX960M 中的工作设置:

My Working setup in Windows 10 and GTX960M:

  • 安装 python 3.5.x
  • Microsoft Visual Studio 2015 社区版.
  • 下载并安装 CUDA 工具包 8.0
  • 下载 CuDNN v5.1.
  • 在 PATH 中设置 CUDA_HOME (\CUDA) 和 %CUDA_HOME%\bin.
  • 将 cuDNN 文件解压缩到一个文件夹并将该位置(bin、lib、include 文件夹所在的文件夹)也添加到 PATH 中,确保在 %PATH% 中正确设置了 cuDNN DLL.
  • 将 cuDNN 中的相应文件复制到 cuda 安装目录中的文件夹(这解决了我的问题):将 cudnn64_5.dll 复制到 C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\bin.将 cudnn.h 复制到 C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\include.将 cudnn.lib 复制到 C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\lib\x64.
  • 确保我在 C:\Windows\System32 和 C:\Windows\SysWOW64 中有 MSVCP140.dll.如果没有从这里下载:https://www.microsoft.com/en-us/download/details.aspx?id=53587 并安装它.
  • Install python 3.5.x
  • Microsoft visual studio 2015 community edition.
  • Download and install CUDA toolkit 8.0
  • Download CuDNN v5.1.
  • Set CUDA_HOME (\CUDA) and %CUDA_HOME%\bin in PATH.
  • Extract the cuDNN files to a folder and add that location(the folder where bin,lib, include folders are) also to PATH make sure that cuDNN DLLs are properly set in %PATH%.
  • Copy the respective files from cuDNN to folders in cuda installation directory(This solved my issues): copy cudnn64_5.dll to C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\bin. copy cudnn.h to C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\include. copy cudnn.lib to C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\lib\x64.
  • Make sure that I have MSVCP140.dll in C:\Windows\System32 and C:\Windows\SysWOW64. If not download it from here: https://www.microsoft.com/en-us/download/details.aspx?id=53587 and install it.

我强烈认为这些版本控制在这种情况下有点重要.我尝试使用失败的 cuDNN 6.0.但 5.1 有效.

I strongly think these versioning is a bit important in this case. I tried using cuDNN 6.0 which failed. but 5.1 worked.