Boost.Python 示例,Windows 7 x64,“ImportError:DLL 加载失败:找不到指定的模块。”

发布于 2024-12-15 12:29:00 字数 300 浏览 3 评论 0原文

过去 2 天,我尝试从 Boost.Python 启动示例,并出现“ImportError:DLL 加载失败:找不到指定的模块”错误,同时尝试加载已编译(使用 bjam)的 pyd 模块。我使用的是 Windows 7 x64、Python 2.7 x64 和 Boost 1.47。我在 StackOverflow 和其他网站(包括)上跟进了不同的答案。全新安装(Python 32 和 64 位,Boost 预编译),手动 Boost 的库构建,使用依赖遍历器检查 DLL 等等,但没有成功。我注册是为了分享该解决方案,该解决方案在这里有效,我希望它可以帮助那些遇到同样错误的人;)

I've spent last 2 days trying to launch examples from Boost.Python with the "ImportError: DLL load failed: The specified module could not be found" error, while trying to load compiled (using bjam) pyd modules. I was using Windows 7 x64, Python 2.7 x64 with Boost 1.47. I've followed up different answers on StackOverflow and other sites incl. fresh installs (Python 32 and 64 bit, Boost precompiled), manual Boost's libraries building, DLL checks with dependency walker and so on, with no luck. I registered to share the solution, which worked here and which I hope may help someone, struggling with the same error ;)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

溺渁∝ 2024-12-22 12:29:01

无需使用 regedit

  1. 两种解决方案,在构建 dll 时 添加 BOOST_PYTHON_STATIC_LIB marco。它会让
    boost.python 静态链接到您的 dll 文件而不是动态加载
    在运行时。
  2. 将 boost.python dll 添加到 PATH 或将其复制到 dll 所在的同一目录

Two solution, no need to use regedit

  1. add BOOST_PYTHON_STATIC_LIB marco when build your dll. It will let
    boost.python static link to your dll file rather than dynamic load
    in runtime.
  2. add boost.python dll to PATH or copy it to same dir where your dll locate
极度宠爱 2024-12-22 12:29:01

问题出在 KB2264107 Windows 更新 (http://support.microsoft.com/kb/2264107) 上,“扰乱”了 DLL 搜索例程(安全修复)。将注册表值 [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager] : CWDIllegalInDllSearch 设置为 0,允许正确加载 DLL 文件并正确导入 .pyd 模块。在其他 Windows 版本上也可能会发生这种情况。

The problem was with the KB2264107 Windows update (http://support.microsoft.com/kb/2264107), "messing" with DLL search routine (security fix). Setting the registry value [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager] : CWDIllegalInDllSearch to 0, allowed to properly load DLL files and properly import .pyd modules. This may also happen on other Windows versions.

人间不值得 2024-12-22 12:29:01

我的解决方案是下载microsoft Visual C++ 2015 redistribute
https://www.microsoft.com/en-us/下载/details.aspx?id=48145

my soluition is download microsoft visual c++ 2015 redistribute
https://www.microsoft.com/en-us/download/details.aspx?id=48145

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文