2017-07-07 67 views
0


當我在安裝後導入張量流時,出現以下錯誤。
我做了什麼:
1. PIP安裝--upgrade tensorflow
2. Python版本3.5.2是
3.我想安裝僅CPU tensorflow。
4.操作系統是Windows 8.1
安裝Tensorflow CPU時發生錯誤Windows 8.1 Python 3.5.2

>>> import tensorflow 
    Traceback (most recent call last): 
     File "C:\Users\Student\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 18, in swig_import_helper 
     return importlib.import_module(mname) 
     File "C:\Users\Student\AppData\Local\Programs\Python\Python35\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\Student\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 41, in <module> 
     from tensorflow.python.pywrap_tensorflow_internal import * 
     File "C:\Program Files\JetBrains\PyCharm 2017.1.1\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import 
     module = self._system_import(name, *args, **kwargs) 
     File "C:\Users\Student\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 21, in <module> 
     _pywrap_tensorflow_internal = swig_import_helper() 
     File "C:\Users\Student\AppData\Local\Programs\Python\Python35\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\Student\AppData\Local\Programs\Python\Python35\lib\importlib\__init__.py", line 126, in import_module 
     return _bootstrap._gcd_import(name[level:], package, level) 
    ImportError: No module named '_pywrap_tensorflow_internal' 
    During handling of the above exception, another exception occurred: 
    Traceback (most recent call last): 
     File "<input>", line 1, in <module> 
     File "C:\Program Files\JetBrains\PyCharm 2017.1.1\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import 
     module = self._system_import(name, *args, **kwargs) 
     File "C:\Users\Student\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\__init__.py", line 24, in <module> 
     from tensorflow.python import * 
     File "C:\Program Files\JetBrains\PyCharm 2017.1.1\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import 
     module = self._system_import(name, *args, **kwargs) 
     File "C:\Users\Student\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\__init__.py", line 49, in <module> 
     from tensorflow.python import pywrap_tensorflow 
     File "C:\Program Files\JetBrains\PyCharm 2017.1.1\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import 
     module = self._system_import(name, *args, **kwargs) 
     File "C:\Program Files\JetBrains\PyCharm 2017.1.1\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import 
     module = self._system_import(name, *args, **kwargs) 
     File "C:\Users\Student\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 52, in <module> 
     raise ImportError(msg) 
    ImportError: Traceback (most recent call last): 
     File "C:\Users\Student\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 18, in swig_import_helper 
     return importlib.import_module(mname) 
     File "C:\Users\Student\AppData\Local\Programs\Python\Python35\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\Student\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 41, in <module> 
     from tensorflow.python.pywrap_tensorflow_internal import * 
     File "C:\Program Files\JetBrains\PyCharm 2017.1.1\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import 
     module = self._system_import(name, *args, **kwargs) 
     File "C:\Users\Student\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 21, in <module> 
     _pywrap_tensorflow_internal = swig_import_helper() 
     File "C:\Users\Student\AppData\Local\Programs\Python\Python35\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\Student\AppData\Local\Programs\Python\Python35\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 

回答

0

安裝第一蟒蛇 然後嘗試從https://www.tensorflow.org/install/install_windows

安裝使用anaconda版張量流然後pycharm會自動檢測tensorflow

如果問題仍然存在,那麼試試這個youtube視頻,它肯定會幫你安裝在pycharm中https://www.youtube.com/watch?v=83vR1Nz3dHA&t=4s

+0

OP不應該安裝蟒蛇安裝Tensorflow,因爲PIP是正式支持的安裝方法,而蟒蛇的支持是唯一的社區提供的,並且可能不是長期可靠 –

0

只是援引在另一個線程,是有關您的問題找到了答案:

要麼錯誤表明你的系統沒有安裝MSVCP140.DLL, 這TensorFlow需要。

要修正這個錯誤:

  1. 確定MSVCP140.DLL是否在您的%PATH%變量。
  2. 如果MSVCP140.DLL不在您的%PATH%中,請安裝包含此DLL的 Visual C++ 2015 redistributable(x64版本)。

原來的答覆:https://stackoverflow.com/a/42011114/4895899

相關問題