关于张量流导入错误

时间:2019-01-16 10:22:08

标签: python

当我尝试导入tensorflow时,以下错误正在蔓延

C:\Windows\system32>python
Python 3.5.4 (v3.5.4:3f56838, Aug  8 2017, 02:17:05) [MSC v.1900 64 bit (AMD64)]
 on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow
Traceback (most recent call last):
  File "C:\Program Files\Python35\lib\site-packages\tensorflow\python\pywrap_ten
sorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "C:\Program Files\Python35\lib\site-packages\tensorflow\python\pywrap_ten
sorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "C:\Program Files\Python35\lib\site-packages\tensorflow\python\pywrap_ten
sorflow_internal.py", line 24, in swig_import_helper
    _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, descript
ion)
  File "C:\Program Files\Python35\lib\imp.py", line 243, in load_module
    return load_dynamic(name, filename, file)
  File "C:\Program Files\Python35\lib\imp.py", line 343, in load_dynamic
    return _load(spec)
ImportError: DLL load failed with error code -1073741795

在处理上述异常期间,发生了另一个异常:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Program Files\Python35\lib\site-packages\tensorflow\__init__.py", lin
e 24, in <module>
    from tensorflow.python import pywrap_tensorflow  # pylint: disable=unused-im
port
  File "C:\Program Files\Python35\lib\site-packages\tensorflow\python\__init__.p
y", line 49, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "C:\Program Files\Python35\lib\site-packages\tensorflow\python\pywrap_ten
sorflow.py", line 74, in <module>
    raise ImportError(msg)
ImportError: Traceback (most recent call last):
  File "C:\Program Files\Python35\lib\site-packages\tensorflow\python\pywrap_ten
sorflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "C:\Program Files\Python35\lib\site-packages\tensorflow\python\pywrap_ten
sorflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "C:\Program Files\Python35\lib\site-packages\tensorflow\python\pywrap_ten
sorflow_internal.py", line 24, in swig_import_helper
    _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, descript
ion)
  File "C:\Program Files\Python35\lib\imp.py", line 243, in load_module
    return load_dynamic(name, filename, file)
  File "C:\Program Files\Python35\lib\imp.py", line 343, in load_dynamic
    return _load(spec)
ImportError: DLL load failed with error code -1073741795


Failed to load the native TensorFlow runtime.

See https://www.tensorflow.org/install/errors

1 个答案:

答案 0 :(得分:0)

这可能与TensorFlow尝试访问GPU的情况有关,例如您的计算机上没有所需的CUDA版本,如this Github issue上的建议