编译时跳过Boost.Python dll 我对Python编程很新,我想把一些C++的DLL集成到Python中。我发现boost.python是这个问题最常见的答案,并且一直在尝试用boost.python包附带的一个简单的“hello world”应用程序来测试它。在http://www.boost.org/doc/libs/1_54_0/libs/python/doc/tutorial/doc/html/python/hello.html

编译时跳过Boost.Python dll 我对Python编程很新,我想把一些C++的DLL集成到Python中。我发现boost.python是这个问题最常见的答案,并且一直在尝试用boost.python包附带的一个简单的“hello world”应用程序来测试它。在http://www.boost.org/doc/libs/1_54_0/libs/python/doc/tutorial/doc/html/python/hello.html,c++,python,visual-studio-2010,boost,boost-python,C++,Python,Visual Studio 2010,Boost,Boost Python,我正在使用Microsoft Visual Studio 10.0运行Windows 7 我的python目录是'C:\Python27',Boost是'C:\Boost\Boost\u 1\u 54\u 0' 我已经使用msvc:10.0将user-config.jam文件设置为和使用python:2.7:C:\\Python27 当我调用bjam时,我得到以下结果 ...failed msvc.link.dll C:\Boost\boost_1_54_0\bin.v2\libs\python

我正在使用Microsoft Visual Studio 10.0运行Windows 7

我的python目录是
'C:\Python27'
,Boost是
'C:\Boost\Boost\u 1\u 54\u 0'

我已经使用msvc:10.0将user-config.jam文件设置为
使用python:2.7:C:\\Python27

当我调用bjam时,我得到以下结果

...failed msvc.link.dll C:\Boost\boost_1_54_0\bin.v2\libs\python\build\msvc-10.0\debug\boost_python-vc100-gd-1_54.dll C:\Boost\boost_1_54_0\bin.v2\libs\python\build\msvc-10.0\debug\boost_python-vc100-gd-1_54.lib C:\Boost\boost_1_54_0\bin.v2\libs\python\build\msvc-10.0\debug\boost_python-vc100-gd-1_54.pdb...
...removing C:\Boost\boost_1_54_0\bin.v2\libs\python\build\msvc-10.0\debug\boost_python-vc100-gd-1_54.lib
...removing C:\Boost\boost_1_54_0\bin.v2\libs\python\build\msvc-10.0\debug\boost_python-vc100-gd-1_54.pdb
...skipped <pbin\msvc-10.0\debug>hello_ext.pyd for lack of <pC:\Boost\boost_1_54_0\bin.v2\libs\python\build\msvc-10.0\debug>boost_python-vc100-gd-1_54.lib...
...skipped <pbin\msvc-10.0\debug>hello_ext.lib for lack of <pC:\Boost\boost_1_54_0\bin.v2\libs\python\build\msvc-10.0\debug>boost_python-vc100-gd-1_54.lib...
...skipped <pbin\msvc-10.0\debug>hello_ext.pdb for lack of <pC:\Boost\boost_1_54_0\bin.v2\libs\python\build\msvc-10.0\debug>boost_python-vc100-gd-1_54.lib...
...skipped <p.>boost_python-vc100-gd-1_54.dll for lack of <pC:\Boost\boost_1_54_0\bin.v2\libs\python\build\msvc-10.0\debug>boost_python-vc100-gd-1_54.dll...
...skipped <p.>hello_ext.pyd for lack of <pbin\msvc-10.0\debug>hello_ext.pyd...
...skipped <pbin\hello.test\msvc-10.0\debug>hello for lack of <pbin\msvc-10.0\debug>hello_ext.pyd...
...failed updating 3 targets...
...skipped 7 targets...

我建议在配置文件中提及python安装路径:

using python : 2.7 : C:\Python27\;

您是否将cd刻录到jamroot和hello.cpp所在的目录中

解决方法:首先,我通过运行
b2 toolset=msvc-10.0来重建boost.python——在
C:\boost\boost\u 1_54_0
中使用python--user config=user-config.jam--build type=complete stage
boost\u python-vc100-mt-gd-1_54.lib
文件复制到教程文件夹中。不确定这是否是最好的解决方案,但它现在似乎正在工作。

对不起,我在用户配置中也这样做了,是的,我与jamroot和hello.cpp的目录相同。在“bin”文件夹中,它创建了一个“hello.test”文件夹,其中不包含任何内容,而“msvc-10.0”文件夹中包含“hello.obj”、“hello.obj.rsp”和“hello_ext.pyd.rsp”。它看起来不像末尾的“toolset”,但我可以在调用bjam no时添加该参数?否则我仍然得到…更新3个目标失败。。。然后…跳过了一个目标。。。感谢you@gargavin很抱歉打错了,可惜打错了。我希望你能得到一个好答案。我将删除注释以减少噪音,因为它没有帮助。解决方法:首先,我通过运行
b2 toolset=msvc-10.0——使用python--user config=user-config.jam--build type=complete stage
C:\boost\boost\boost\u 1\u 54\u 0
中重建boost.python,然后我将
boost\u python-vc100-mt-gd-1\u 54.lib
文件复制到教程中文件夹。不确定这是否是最好的解决方案,但它现在似乎正在工作。您是否添加
C:\Boost\Boost\u 1_54_0
文件夹作为链接器查找
Boost\u python-vc100-mt-gd-1_54.lib
的包含目录?在windows上编译boost.python应用程序时,我不需要将boost_python*.lib移动到本地目录。
using python : 2.7 : C:\Python27\;