python - Tensorflow-gpu 1.9 无法在 Pycharm 上运行

标签 python tensorflow pycharm cudnn

我无法在 pycharm 中导入tensorflow,它会引发以下错误:

ImportError: Could not find 'cudart64_90.dll'. TensorFlow requires that this DLL be installed in a directory that is named in your %PATH% environment variable. Download and install CUDA 9.0 from this URL: https://developer.nvidia.com/cuda-toolkit

我检查了这个 cudart 文件并将其添加到 %PATH%

它在 CLI 和 python shell 上完美运行。

我有

CUDA v9.0
cuDNN v7.0.5
tensorflow-gpu v1.9

回显%PATH%

C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\bin;
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\libnvvp;
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\extras\CUPTI\libx64;

cudar64_90.dll目录:

07/27/2018  02:53 PM    <DIR>          .
07/27/2018  02:53 PM    <DIR>          ..
09/02/2017  03:45 PM           163,840 bin2c.exe
07/27/2018  02:28 PM    <DIR>          crt
05/16/2018  11:18 PM        55,161,856 cublas64_90.dll
09/02/2017  03:45 PM           347,136 cuda-memcheck.exe
09/02/2017  03:45 PM         3,930,112 cudafe++.exe
09/02/2017  03:45 PM         4,226,048 cudafe.exe
09/02/2017  03:46 PM           299,520 cudart32_90.dll
09/02/2017  03:46 PM           373,760 cudart64_90.dll
11/16/2017  07:51 PM       286,877,184 cudnn64_7.dll
09/02/2017  03:46 PM       131,197,952 cufft64_90.dll
09/02/2017  03:46 PM           199,680 cufftw64_90.dll
09/02/2017  03:46 PM         3,575,808 cuinj32_90.dll
09/02/2017  03:46 PM         4,495,360 cuinj64_90.dll
09/02/2017  03:45 PM         1,411,072 cuobjdump.exe
09/02/2017  03:46 PM        48,057,344 curand64_90.dll
09/02/2017  03:46 PM        75,222,016 cusolver64_90.dll
09/02/2017  03:46 PM        54,782,464 cusparse64_90.dll
09/02/2017  03:45 PM           246,784 fatbinary.exe
09/02/2017  03:46 PM         1,274,880 gpu-library-advisor.exe
09/02/2017  03:46 PM           205,824 nppc64_90.dll
09/02/2017  03:46 PM         9,744,384 nppial64_90.dll
09/02/2017  03:46 PM         3,953,664 nppicc64_90.dll
09/02/2017  03:46 PM         1,035,264 nppicom64_90.dll
09/02/2017  03:46 PM         7,291,392 nppidei64_90.dll
09/02/2017  03:46 PM        55,641,088 nppif64_90.dll
09/02/2017  03:46 PM        26,491,904 nppig64_90.dll
09/02/2017  03:46 PM         4,767,232 nppim64_90.dll
09/02/2017  03:46 PM        14,943,232 nppist64_90.dll
09/02/2017  03:46 PM           179,200 nppisu64_90.dll
09/02/2017  03:46 PM         2,629,120 nppitc64_90.dll
09/02/2017  03:46 PM         9,024,512 npps64_90.dll
05/16/2018  11:18 PM           241,664 nvblas64_90.dll
09/02/2017  03:45 PM           325,632 nvcc.exe
09/02/2017  03:45 PM               328 nvcc.profile
09/02/2017  03:45 PM        16,261,120 nvdisasm.exe
09/02/2017  03:46 PM        15,747,584 nvgraph64_90.dll
09/02/2017  03:45 PM         7,202,304 nvlink.exe
09/02/2017  03:45 PM         4,005,376 nvprof.exe
09/02/2017  03:45 PM           181,248 nvprune.exe
09/02/2017  03:46 PM         3,182,592 nvrtc-builtins64_90.dll
09/02/2017  03:46 PM        17,302,016 nvrtc64_90.dll
09/02/2017  03:46 PM                53 nvvp.bat
05/16/2018  11:16 PM         7,082,496 ptxas.exe

最佳答案

深入了解 tensorflow-1.9 release branch ,看起来他们使用了 CUDA 9.0CUDNN 7.1.4

所以我认为你应该下载 CUDNN 7.1.4。希望这个问题能够得到解决。

您可以通过运行这个方便的script来检查一切是否正常。由 tensorflow 的作者之一编写。它会准确地向您显示哪些地方工作不正常。

编辑: 对于 CUDA 10.0,它是 CUDNN 版本 7.6.2.24-1(请参阅 here)。

关于python - Tensorflow-gpu 1.9 无法在 Pycharm 上运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51560617/

相关文章:

python - tensorflow : DLL load failed: A dynamic link library (DLL) initialization routine failed

Python on Arm,非法指令

python - 如何混合不平衡的数据集以达到每个标签所需的分布?

tensorflow - TensorFlow 中的批处理是什么?

python - 如何设置 PyCharm 不打开所有最后的项目?

django-templates - PyCharm:重新格式化代码破坏了 Django 模板

python - 打印功能错误 "End of statement expected"

javascript - 如何让 Flask 识别静态文件夹中的 CSS 和 JS 文件?

python - 如何将 GridSearchCV 用于带有 SVC 估计器的 OneVsRestClassifier?

python - Redis 扫描命令匹配选项在 Python 中不起作用