2017-07-07 63 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

相关问题