ImportError: DLL load failed with error code -1073741795

快来打我* 2023-08-17 17:35 231阅读 0赞

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

  1. >>> import tensorflow
  2. Traceback (most recent call last):
  3. File "D:\AppSetPlace\python36\lib\site-packages\tensorflow\python\pywrap_tenso
  4. rflow.py", line 58, in <module>
  5. from tensorflow.python.pywrap_tensorflow_internal import *
  6. File "D:\AppSetPlace\python36\lib\site-packages\tensorflow\python\pywrap_tenso
  7. rflow_internal.py", line 28, in <module>
  8. _pywrap_tensorflow_internal = swig_import_helper()
  9. File "D:\AppSetPlace\python36\lib\site-packages\tensorflow\python\pywrap_tenso
  10. rflow_internal.py", line 24, in swig_import_helper
  11. _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, descript
  12. ion)
  13. File "D:\AppSetPlace\python36\lib\imp.py", line 242, in load_module
  14. return load_dynamic(name, filename, file)
  15. File "D:\AppSetPlace\python36\lib\imp.py", line 342, in load_dynamic
  16. return _load(spec)
  17. ImportError: DLL load failed with error code -1073741795
  18. During handling of the above exception, another exception occurred:
  19. Traceback (most recent call last):
  20. File "<stdin>", line 1, in <module>
  21. File "D:\AppSetPlace\python36\lib\site-packages\tensorflow\__init__.py", line
  22. 28, in <module>
  23. from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-im
  24. port
  25. File "D:\AppSetPlace\python36\lib\site-packages\tensorflow\python\__init__.py"
  26. , line 49, in <module>
  27. from tensorflow.python import pywrap_tensorflow
  28. File "D:\AppSetPlace\python36\lib\site-packages\tensorflow\python\pywrap_tenso
  29. rflow.py", line 74, in <module>
  30. raise ImportError(msg)
  31. ImportError: Traceback (most recent call last):
  32. File "D:\AppSetPlace\python36\lib\site-packages\tensorflow\python\pywrap_tenso
  33. rflow.py", line 58, in <module>
  34. from tensorflow.python.pywrap_tensorflow_internal import *
  35. File "D:\AppSetPlace\python36\lib\site-packages\tensorflow\python\pywrap_tenso
  36. rflow_internal.py", line 28, in <module>
  37. _pywrap_tensorflow_internal = swig_import_helper()
  38. File "D:\AppSetPlace\python36\lib\site-packages\tensorflow\python\pywrap_tenso
  39. rflow_internal.py", line 24, in swig_import_helper
  40. _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, descript
  41. ion)
  42. File "D:\AppSetPlace\python36\lib\imp.py", line 242, in load_module
  43. return load_dynamic(name, filename, file)
  44. File "D:\AppSetPlace\python36\lib\imp.py", line 342, in load_dynamic
  45. return _load(spec)
  46. 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)

转载于:https://www.cnblogs.com/144823836yj/p/11382056.html

发表评论

表情:
评论列表 (有 0 条评论,231人围观)

还没有评论,来说两句吧...

相关阅读