2017-05-07 229 views
0

我想在anaconda環境(python版本3.5)中安裝tensorflow-gpu。但是,我得到了一些錯誤,主要是:缺少DLL和pywrap_tensorflow。 Tensorflow-gpu安裝錯誤

  • DLL加載失敗
  • 沒有名爲「_pywrap_tensorflow_internal」模塊

看來,這個錯誤是很常見的,但是,我不知道爲什麼來自另一個問題的解決方案不起作用。

  1. 我在我的路徑中有一個MSVCP140.DLL。我通過where MSVCP140.DLL進行檢查。這是修復建議here
  2. 我已經從here和來自here的cuDNN 5.1(而不是cuDNN 6.0)安裝了CUDA 8.0。
  3. 我已經添加了cudnn64_5.dll(... \ bin)的路徑
  4. tensorflow的CPU版本運行正常,沒有錯誤。

我試過重裝CUDA和tensorflow-gpu,但它仍然不起作用。任何幫助?


錯誤消息:

>ImportError: Traceback (most recent call last): 
    File "C:\Users\user\Anaconda3\envs\py35\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 18, in swig_import_helper 
    return importlib.import_module(mname) 
    File "C:\Users\user\Anaconda3\envs\py35\lib\importlib\__init__.py", line 126, in import_module 
    return _bootstrap._gcd_import(name[level:], package, level) 
    File "<frozen importlib._bootstrap>", line 986, in _gcd_import 
    File "<frozen importlib._bootstrap>", line 969, in _find_and_load 
    File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked 
    File "<frozen importlib._bootstrap>", line 666, in _load_unlocked 
    File "<frozen importlib._bootstrap>", line 577, in module_from_spec 
    File "<frozen importlib._bootstrap_external>", line 906, in create_module 
    File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed 
ImportError: DLL load failed: The specified module could not be found. 

>During handling of the above exception, another exception occurred: 

>Traceback (most recent call last): 
    File "C:\Users\user\Anaconda3\envs\py35\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 41, in <module> 
    from tensorflow.python.pywrap_tensorflow_internal import * 
    File "C:\Users\user\Anaconda3\envs\py35\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 21, in <module> 
    _pywrap_tensorflow_internal = swig_import_helper() 
    File "C:\Users\user\Anaconda3\envs\py35\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 20, in swig_import_helper 
    return importlib.import_module('_pywrap_tensorflow_internal') 
    File "C:\Users\user\Anaconda3\envs\py35\lib\importlib\__init__.py", line 126, in import_module 
    return _bootstrap._gcd_import(name[level:], package, level) 
ImportError: No module named '_pywrap_tensorflow_internal' 


>Failed to load the native TensorFlow runtime. 

>See https://www.tensorflow.org/install/install_sources#common_installation_problems 

>for some common reasons and solutions. Include the entire stack trace 
above this error message when asking for help. 

回答

0

我有完全相同的問題很長一段時間,似乎剛纔解決了這個問題對我來說。

安裝cuDNN 6.0並確認cuda/bin中的dll名稱爲cudnn64_6.dll。只將名稱更改爲cudnn64_5.dll(並確保它已添加到您的路徑中)。

希望這會解決您的問題。

+0

[這裏](http://stackoverflow.com/questions/43577923/cannot-import-tensorflow-for-gpu-on-windows-10)實際上是我從中得到答案的地方。 – ThunderGT

+0

哇,似乎工作!由於Tensorflow不支持cuDNN 6.0,所以這很奇怪。也許我錯了。儘管非常感謝你。 –