解決安裝TensorFlow GPU缺少文件的一個比較終極的辦法


可能的報錯信息

TensorFlow 下,導入這份配置的時候 python 停止運行

ImportError: DLL load failed: 找不到指定的模塊 或 ImportError: No module named ‘_pywrap_tensorflow’ 或 Failed to load the native TensorFlow runtime.

importlib.import_module(mname)

等等類似的

我的出錯配置

tensorflow_gpu-1.2.1

cudnn-8.0-windows7-x64-v6.0.0

或者cudnn-8.0-windows7-x64-v7.1

或者cudnn-8.0-windows7-x64-v7

以上的cudnn都是錯誤的,得使用
cudnn-8.0-windows7-x64-v5.1

下面說下怎么知道的

直接放代碼。

在部署好的環境里面運行這份代碼會給出相應的提示。
https://gist.github.com/mrry/ee5dbcfdd045fa48a27d56664411d41c

依據提示去看自己缺少什么。

附錄原文

https://github.com/tensorflow/tensorflow/issues/7623

code

Let's see ... following is the info. After running tensorflow_self_check.py I see that it doesn't find a couple of cud*.dll needed for the GPU version of tensorflow. That's probably because I assumed I already had that installed as part of the NVIDIA software that comes with this PC. That's what I get for assuming!

NVIDIA GeForce GTX 960, 2GB

Intel Core i7-6700K @ 4.0GHz

C:\Users\jeffh>pip list | findstr tensorflow
tensorflow-gpu (1.2.1)

Run tensorflow_self_check.py script (note - syntax error line 111 of https://gist.github.com/mrry/ee5dbcfdd045fa48a27d56664411d41c ):

C:\Users\jeffh\Downloads>python tensorflow_self_check.py
ERROR: Failed to import the TensorFlow module.

  • Python version is 3.5.

  • TensorFlow is installed at: C:\Users\jeffh\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow

  • Could not load 'cudart64_80.dll'. The GPU version of TensorFlow
    requires that this DLL be installed in a directory that is named in
    your %PATH% environment variable. Download and install CUDA 8.0 from
    this URL: https://developer.nvidia.com/cuda-toolkit

  • Could not load 'cudnn64_5.dll'. The GPU version of 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 it is often found in a
    different directory from the CUDA DLLs. You may install the
    necessary DLL by downloading cuDNN 5.1 from this URL:
    https://developer.nvidia.com/cudnn
    Traceback (most recent call last):
    File "tensorflow_self_check.py", line 137, in
    main()
    File "tensorflow_self_check.py", line 108, in main
    if not cudnn5_found or not cudnn6_found:
    UnboundLocalError: local variable 'cudnn5_found' referenced before assignment


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM