ImportError: DLL load failed with error code -1073741795

Win7,python3.6,pip安装tensorflow之后报错:

>>> import tensorflow
Traceback (most recent call last):
  File "D:\AppSetPlace\python36\lib\site-packages\tensorflow\python\pywrap_tenso
rflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "D:\AppSetPlace\python36\lib\site-packages\tensorflow\python\pywrap_tenso
rflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "D:\AppSetPlace\python36\lib\site-packages\tensorflow\python\pywrap_tenso
rflow_internal.py", line 24, in swig_import_helper
    _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, descript
ion)
  File "D:\AppSetPlace\python36\lib\imp.py", line 242, in load_module
    return load_dynamic(name, filename, file)
  File "D:\AppSetPlace\python36\lib\imp.py", line 342, in load_dynamic
    return _load(spec)
ImportError: DLL load failed with error code -1073741795

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "D:\AppSetPlace\python36\lib\site-packages\tensorflow\__init__.py", line
28, in <module>
    from tensorflow.python import pywrap_tensorflow  # pylint: disable=unused-im
port
  File "D:\AppSetPlace\python36\lib\site-packages\tensorflow\python\__init__.py"
, line 49, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "D:\AppSetPlace\python36\lib\site-packages\tensorflow\python\pywrap_tenso
rflow.py", line 74, in <module>
    raise ImportError(msg)
ImportError: Traceback (most recent call last):
  File "D:\AppSetPlace\python36\lib\site-packages\tensorflow\python\pywrap_tenso
rflow.py", line 58, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "D:\AppSetPlace\python36\lib\site-packages\tensorflow\python\pywrap_tenso
rflow_internal.py", line 28, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "D:\AppSetPlace\python36\lib\site-packages\tensorflow\python\pywrap_tenso
rflow_internal.py", line 24, in swig_import_helper
    _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, descript
ion)
  File "D:\AppSetPlace\python36\lib\imp.py", line 242, in load_module
    return load_dynamic(name, filename, file)
  File "D:\AppSetPlace\python36\lib\imp.py", line 342, in load_dynamic
    return _load(spec)
ImportError: DLL load failed with error code -1073741795

  

解决办法:

有人说(https://blog.csdn.net/fhqlongteng/article/details/80279197)是CPU太老了,我也不太懂CPU,但安装他说的办法:

  问题的原因是我的电脑(联想V460)的cpu比较老,不支持AVX指令导致的,需要安装特殊编译的tensorflow 1.6.0版本才可以解决,注意安装时要先卸载先前安装的1.8.0版本。关于这个问题的详细解决过程可以参考github上面tensorflow的论坛

问题解决了。

 

安装上面说的版本之后还可能出现一个错误:

from google.protobuf.pyext import _message,使用tensorflow出现 ImportError: DLL load failed

按照这篇博客(https://blog.csdn.net/u012193416/article/details/86301899)说的方法解决了问题:

 在自动安装了tensorflow时, protobuf安装的是最新版本3.6.1, 出现了不兼容的问题。

更换为 protobuf 3.6.0即可(pip install protobuf==3.6.0)

posted @ 2019-08-20 11:48  梦醒江南·Infinite  阅读(1929)  评论(0编辑  收藏  举报