packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module>

本文探讨了在Windows环境下安装TensorFlow-GPU遇到的DLL加载失败问题,分析了可能的原因包括cuDNN版本不兼容、系统缺少Visual C++ Redistributable以及TensorFlow与CUDA版本不匹配。提供了降低cuDNN版本、安装Visual C++ Redistributable和调整TensorFlow版本的解决方案。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Traceback (most recent call last):
File “C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py”, line 58, in
from tensorflow.python.pywrap_tensorflow_internal import *
File “C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py”, line 28, in
_pywrap_tensorflow_internal = swig_import_helper()
File “C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py”, line 24, in swig_import_helper
_mod = imp.load_module(’_pywrap_tensorflow_internal’, fp, pathname, description)
File “C:\ProgramData\Anaconda3\lib\imp.py”, line 243, in load_module
return load_dynamic(name, filename, file)
File “C:\ProgramData\Anaconda3\lib\imp.py”, line 343, in load_dynamic
return _load(spec)
ImportError: DLL load failed: 找不到指定的模块。

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “”, line 1, in
File “C:\ProgramData\Anaconda3\lib\site-packages\tensorflow_init_.py”, line 24, in
from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
File “C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python_init_.py”, line 49, in
from tensorflow.python import pywrap_tensorflow
File “C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py”, line 74, in
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File “C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py”, line 58, in
from tensorflow.python.pywrap_tensorflow_internal import *
File “C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py”, line 28, in
_pywrap_tensorflow_internal = swig_import_helper()
File “C:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py”, line 24, in swig_import_helper
_mod = imp.load_module(’_pywrap_tensorflow_internal’, fp, pathname, description)
File “C:\ProgramData\Anaconda3\lib\imp.py”, line 243, in load_module
return load_dynamic(name, filename, file)
File “C:\ProgramData\Anaconda3\lib\imp.py”, line 343, in load_dynamic
return _load(spec)
ImportError: DLL load failed: 找不到指定的模块。

这个错误属于安装tensorflow-gpu 之后,运行报错
在这里插入图片描述

1、可能是cudnn 的版本不兼容cuda 和tensorflow ,建议降低cudnn的版本

当前使用的 tensorflow-gpu 是 tensorflow-gpu-1.13.1
cuda 是 9.0版本
cudnn 是7.5版本

2、原因可能:
windows cpu版, tensorflow安装后,在Python环境下“import tensorflow”时出现上述错误。
解决办法: install the Visual C++ Redistributable 2015 x64 as MSVCP140.DLL may be missing in your system.
https://www.microsoft.com/en-us/download/details.aspx?id=53587

3、可能原因是
当前的tensorflow 版本和cuda版本不兼容,卸载tensorflow版本,重新安装低版本

可以尝试降低tensorflow-gpu版本
pip3 install --upgrade --force-reinstall tensorflow-gpu==1.12.0

或者直接安装最新的tensorflow 版本
C:\Windows\system32>pip install tensorflow-gpu
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting tensorflow-gpu
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/6d/c4/d5b81c2d40be9219a23852f630df9e1ed88a22f88da774e1bf69261f9b32/tensorflow_gpu-1.13.1-cp36-cp36m-win_amd64.whl (259.7MB)

对应的cuda 的版本v10.0 cudnn 版本是7.5版的 tensorflow-gpu是 1.13.1版本的

E:\anaconda\app\python.exe "D:\new learning\RotationCorrection-main\Codes\train.py" Traceback (most recent call last): File "E:\anaconda\app\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module> from tensorflow.python.pywrap_tensorflow_internal import * File "E:\anaconda\app\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module> _pywrap_tensorflow_internal = swig_import_helper() File "E:\anaconda\app\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description) File "E:\anaconda\app\lib\imp.py", line 242, in load_module return load_dynamic(name, filename, file) File "E:\anaconda\app\lib\imp.py", line 342, in load_dynamic return _load(spec) ImportError: DLL load failed: 找不到指定的模块。 During handling of the above exception, another exception occurred: Traceback (most recent call last): File "D:\new learning\RotationCorrection-main\Codes\train.py", line 2, in <module> import tensorflow as tf File "E:\anaconda\app\lib\site-packages\tensorflow\__init__.py", line 24, in <module> from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import File "E:\anaconda\app\lib\site-packages\tensorflow\python\__init__.py", line 49, in <module> from tensorflow.python import pywrap_tensorflow File "E:\anaconda\app\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 74, in <module> raise ImportError(msg) ImportError: Traceback (most recent call last): File "E:\anaconda\app\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module> from tensorflow.python.pywrap_tensorflow_internal import * File "E:\anaconda\app\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module> _pywrap_tensorflow_internal = swig_import_helper() File "E:\anaconda\app\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description) File "E:\anaconda\app\lib\imp.py", line 242, in load_module return load_dynamic(name, filename, file) File "E:\anaconda\app\lib\imp.py", line 342, in load_dynamic return _load(spec) ImportError: DLL load failed: 找不到指定的模块。 Failed to load the native TensorFlow runtime. See https://www.tensorflow.org/install/errors for some common reasons and solutions. Include the entire stack trace above this error message when asking for help.
06-24
Traceback (most recent call last): File "train.py", line 13, in <module> import tensorflow as tf File "/home/nvidia/anaconda3/envs/deephdr/lib/python3.6/site-packages/tensorflow/__init__.py", line 24, in <module> from tensorflow.python import * File "/home/nvidia/anaconda3/envs/deephdr/lib/python3.6/site-packages/tensorflow/python/__init__.py", line 49, in <module> from tensorflow.python import pywrap_tensorflow File "/home/nvidia/anaconda3/envs/deephdr/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py", line 74, in <module> raise ImportError(msg) ImportError: Traceback (most recent call last): File "/home/nvidia/anaconda3/envs/deephdr/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module> from tensorflow.python.pywrap_tensorflow_internal import * File "/home/nvidia/anaconda3/envs/deephdr/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module> _pywrap_tensorflow_internal = swig_import_helper() File "/home/nvidia/anaconda3/envs/deephdr/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in swig_import_helper _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description) File "/home/nvidia/anaconda3/envs/deephdr/lib/python3.6/imp.py", line 242, in load_module return load_dynamic(name, filename, file) File "/home/nvidia/anaconda3/envs/deephdr/lib/python3.6/imp.py", line 342, in load_dynamic return _load(spec) ImportError: libcublas.so.9.0: cannot open shared object file: No such file or directory 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 above this error message when asking for help.
03-15
E:\python3.9.13\python.exe E:\pycharm\study\计算机视觉\test3.py Traceback (most recent call last): File "E:\python3.9.13\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 73, in <module> from tensorflow.python._pywrap_tensorflow_internal import * ImportError: DLL load failed while importing _pywrap_tensorflow_internal: 动态链接库(DLL)初始化例程失败。 During handling of the above exception, another exception occurred: Traceback (most recent call last): File "E:\pycharm\study\计算机视觉\test3.py", line 20, in <module> from 计算机视觉.test2 import ObjectRecognitionDeployer File "E:\pycharm\study\计算机视觉\test2.py", line 1, in <module> import tensorflow as tf File "E:\python3.9.13\lib\site-packages\tensorflow\__init__.py", line 40, in <module> from tensorflow.python import pywrap_tensorflow as _pywrap_tensorflow # pylint: disable=unused-import File "E:\python3.9.13\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 88, in <module> raise ImportError( ImportError: Traceback (most recent call last): File "E:\python3.9.13\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 73, in <module> from tensorflow.python._pywrap_tensorflow_internal import * ImportError: DLL load failed while importing _pywrap_tensorflow_internal: 动态链接库(DLL)初始化例程失败。 Failed to load the native TensorFlow runtime. See https://www.tensorflow.org/install/errors for some common causes and solutions. If you need help, create an issue at https://github.com/tensorflow/tensorflow/issues and include the entire stack trace above this error message.
06-23
Traceback (most recent call last): File "C:\jichuang\Project\pythonProject\.venv1\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 73, in <module> from tensorflow.python._pywrap_tensorflow_internal import * ImportError: DLL load failed while importing _pywrap_tensorflow_internal: 动态链接库(DLL)初始化例程失败。 During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\jichuang\Project\pythonProject\jichuan_UI.py", line 7, in <module> from deepface import DeepFace File "C:\jichuang\Project\pythonProject\.venv1\lib\site-packages\deepface\DeepFace.py", line 15, in <module> import tensorflow as tf File "C:\jichuang\Project\pythonProject\.venv1\lib\site-packages\tensorflow\__init__.py", line 40, in <module> from tensorflow.python import pywrap_tensorflow as _pywrap_tensorflow # pylint: disable=unused-import File "C:\jichuang\Project\pythonProject\.venv1\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 88, in <module> raise ImportError( ImportError: Traceback (most recent call last): File "C:\jichuang\Project\pythonProject\.venv1\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 73, in <module> from tensorflow.python._pywrap_tensorflow_internal import * ImportError: DLL load failed while importing _pywrap_tensorflow_internal: 动态链接库(DLL)初始化例程失败。 Failed to load the native TensorFlow runtime. See https://www.tensorflow.org/install/errors for some common causes and solutions. If you need help, create an issue at https://github.com/tensorflow/tensorflow/issues and include the entire stack trace above this error message.
最新发布
07-08
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值