简体   繁体   English

导入错误:DLL 加载失败。 指定的模块无法找到

[英]Import Error: DLL load failed. The specified module could not be found

I'm a beginner to python.我是python的初学者。 I have installed python on my laptop and its version is Python 2.7.18 (v2.7.18:8d21aa21f2, Apr 20 2020, 13:19:08) [MSC v.1500 32 bit (Intel)] on win32 .我在我的笔记本电脑上安装了 python,它的版本是Python 2.7.18 (v2.7.18:8d21aa21f2, Apr 20 2020, 13:19:08) [MSC v.1500 32 bit (Intel)] on win32 I'm trying to import an existing framework created by others and creating a new sample python file using the existing package.我正在尝试导入其他人创建的现有框架并使用现有包创建新的示例 python 文件。 I wrote a simple line:我写了一个简单的行:

 from machine_lib.pydblib import db

The pydblib is a file automatically generated from SWIG. pydblib 是从 SWIG 自动生成的文件。 The below code is grabbed from the SWIG file:下面的代码是从 SWIG 文件中抓取的:

from sys import version_info as _swig_python_version_info
if _swig_python_version_info >= (2, 7, 0):
    def swig_import_helper():
        import importlib
        pkg = __name__.rpartition('.')[0]
        mname = '.'.join((pkg, '_pydblib')).lstrip('.')
        try:
            return importlib.import_module(mname)
        except ImportError:
            return importlib.import_module('_pydblib')
    _pydblib = swig_import_helper()

The error is at the except block : return importlib.import_module('_pydblib') which says :错误在 except 块: return importlib.import_module('_pydblib')说:

ImportError: DLL load failed: The specified module could not be found in pycharm.

I have gone through the answers for the same error and nothing worked.我已经浏览了相同错误的答案,但没有任何效果。 How can I get rid of this error?我怎样才能摆脱这个错误? I'm happy to share more info if required.如果需要,我很乐意分享更多信息。 Thanks in advance!提前致谢!

Related note if you came here searching for "python", "import error" and "DLL load failed": in Python 3.8 DLL resolution under Windows has changed .相关说明,如果您来到这里搜索“python”、“导入错误”和“DLL 加载失败”:在Python 3.8 中,Windows 下的 DLL 分辨率已更改 Also see what's new in Python 3.8 :另请参阅Python 3.8 中的新功能

DLL dependencies for extension modules and DLLs loaded with ctypes on Windows are now resolved more securely.扩展模块的 DLL 依赖项和在 Windows 上加载 ctypes 的 DLL 现在可以更安全地解决。 Only the system paths, the directory containing the DLL or PYD file, and directories added with add_dll_directory() are searched for load-time dependencies.仅搜索系统路径、包含 DLL 或 PYD 文件的目录以及使用 add_dll_directory() 添加的目录以查找加载时依赖项。 Specifically, PATH and the current working directory are no longer used, and modifications to these will no longer have any effect on normal DLL resolution.具体来说,不再使用 PATH 和当前工作目录,对它们的修改将不再对正常的 DLL 解析产生任何影响。 If your application relies on these mechanisms, you should check for add_dll_directory() and if it exists, use it to add your DLLs directory while loading your library.如果您的应用程序依赖于这些机制,您应该检查 add_dll_directory() 并且如果它存在,在加载您的库时使用它来添加您的 DLL 目录。 Note that Windows 7 users will need to ensure that Windows Update KB2533623 has been installed (this is also verified by the installer).请注意,Windows 7 用户需要确保已安装 Windows Update KB2533623(这也由安装程序验证)。

You can also use ProcessMonitor to check the name of DLLs Python is looking for.您还可以使用ProcessMonitor来检查 Python 正在寻找的 DLL 的名称。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Pyinstaller:导入错误:DLL 加载失败:找不到指定的模块 - Pyinstaller: Import Error: DLL load failed: The specified module could not be found “import torch”给出错误“from torch._C import *, DLL load failed: The specified module could not be found” - "import torch" giving error "from torch._C import *, DLL load failed: The specified module could not be found" ver.2 PyGreSQL ERROR: from _pg import * ImportError: DLL load failed: The specified module could not be found - ver.2 PyGreSQL ERROR: from _pg import * ImportError: DLL load failed: The specified module could not be found Tkinter给出导入错误:DLL加载失败:找不到指定的模块 - Tkinter giving Import Error: DLL load failed: The specified module could not be found 无法导入 tflite-support 包。 接收错误“DLL 加载失败:找不到指定的模块” - Unable to Import tflite-support package. Receiving error "DLL load failed: The specified module could not be found" 尝试导入 sklearn 模块时出错:ImportError:DLL 加载失败:找不到指定的模块 - Error when trying to import sklearn modules : ImportError: DLL load failed: The specified module could not be found 导入错误:DLL加载失败:使用cxfreeze时找不到指定的模块 - Import Error: DLL load failed: The specified module could not be found when using cxfreeze cx_Freeze导入错误:DLL加载失败:找不到指定的模块 - cx_Freeze Import Error: DLL load failed: The specified module could not be found 导入tensorflow错误:DLL加载失败:找不到指定的程序 - Import tensorflow error: DLL load failed: The specified procedure could not be found Tensorflow 错误:ImportError: DLL 加载失败:找不到指定的模块 - Tensorflow Error: ImportError: DLL load failed: The specified module could not be found
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM