2017-07-08 110 views
0

當我嘗試import tensorflow我得到以下錯誤:Tensorflow-GPU:導入錯誤:沒有模塊名爲_pywrap_tensorflow

>>import tensorflow 
    File "C:\Users\...\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\__init__.py", line 24, in <module> 
    from tensorflow.python import * 
    File "C:\Users\...\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\__init__.py", line 72, in <module> 
    raise ImportError(msg) 
ImportError: Traceback (most recent call last): 
    File "C:\Users\...\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\__init__.py", line 66, in <module> 
    from tensorflow.python import pywrap_tensorflow 
    File "C:\Users\...\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 21, in <module> 
    _pywrap_tensorflow = swig_import_helper() 
    File "C:\Users\...\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 20, in swig_import_helper 
    return importlib.import_module('_pywrap_tensorflow') 
    File "C:\Users\...\Anaconda3\envs\tensorflow\lib\importlib\__init__.py", line 37, in import_module 
    __import__(name) 
ImportError: No module named _pywrap_tensorflow 


Failed to load the native TensorFlow runtime. 

See https://github.com/tensorflow/tensorflow/blob/master/tensorflow/g3doc/get_started/os_setup.md#import_error 

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

我安裝了msvcp140.dll Redistributable推薦here,但它並沒有幫助。有任何想法嗎?我正在運行Anaconda3環境。

+0

根據https://github.com/tensorflow/tensorflow/issues/7529,可能是cuDNN沒有正確安裝。你確定它在你的PATH變量中嗎? –

+0

是的,它是有 –

+0

[在Windows上,運行「導入tensorflow」生成沒有模塊命名爲「\ _pywrap \ _tensorflow」錯誤](https://stackoverflow.com/questions/42011070/on-windows-running-import -tensorflow-generated-no-module-named-pywrap-tenso) – user1735003

回答

0

原來,tensorflowwindows需要python 3.5或更高,而我的Python是2.7.8。我發現這是由這個偉大script的幫助,這有助於跟蹤源錯誤,並提供明確的錯誤消息的問題。

相關問題