Boost.Python 示例,Windows 7 x64,“ImportError:DLL 加载失败:找不到指定的模块。”
过去 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
无需使用 regedit
BOOST_PYTHON_STATIC_LIB
marco。它会让boost.python 静态链接到您的 dll 文件而不是动态加载
在运行时。
Two solution, no need to use regedit
BOOST_PYTHON_STATIC_LIB
marco when build your dll. It will letboost.python static link to your dll file rather than dynamic load
in runtime.
问题出在 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.
我的解决方案是下载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