ImportError: DLL load failed with error code -1073741795
Win7,python3.6,pip安装tensorflow之后报错:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | >>> 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)
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 【译】Visual Studio 中新的强大生产力特性
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构
· 字符编码:从基础到乱码解决