无法成功安装Boost.Python [英] Cannot successfully install Boost.Python

查看:152
本文介绍了无法成功安装Boost.Python的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在计算机上安装Boost.Python. (Windows7 64位,Visual Studio 2012,Python 2.7 64位和Boost 1.54)

I am trying to install Boost.Python on my computer. (Windows7 64bit, Visual Studio 2012, Python 2.7 64bit and Boost 1.54)

按照说明进行操作,我已经成功安装了Boost库,然后必须单独安装Boost.Python.

Following the instruction, I've successfully installed the Boost Library, and then I have to separately install Boost.Python.

但是,按照我在

However, as I followed the instruction at here. I am stuck at step 3.1.4.

我输入C:\boost_1_54_0\…\quickstart> bjam toolset=msvc --verbose-test test

然后弹出135个未解决的外部错误.其中之一是:

Then there are 135 unresolved external errors pop out. One of them is:

exec.obj:错误LNK2019:未解析的外部符号 __imp__PyEval_GetGlobals在函数类boost :: python :: api :: object __cdecl boost :: python :: eval(class boost :: python :: str,class boost :: python :: api :: object,class boost :: python :: api :: object) (?eval @ python @ boost @@ YA?AVobject @ api @ 12 @ Vstr @ 12 @ V3412 @ 1 @ Z)........ \ bin.v2 \ libs \ python \ build \ msvc-11.0 \ debug \ boost_python-vc110-gd-1_54.dll

exec.obj : error LNK2019: unresolved external symbol __imp__PyEval_GetGlobals referenced in function "class boost::python::api::object __cdecl boost::python::eval(class boost::python::str,class boost::python::api::object,class boost::python::api::object)" (?eval@python@boost@@YA?AVobject@api@12@Vstr@12@V3412@1@Z)........\bin.v2\libs\python\build\msvc-11.0\debug\boost_python-vc110-gd-1_54.dll

我可以知道如何解决这个问题吗?

May I know how can I work around this?

================================================ ==========

=========================================================

按照@Kyle的建议,我已经卸载了64位Python,并将其替换为32位Python(2.7.5).

Following @Kyle 's advice, I've uninstalled the 64bit Python and replace it with a 32bit Python (2.7.5).

然后,我编写了一个非常简单的代码,如下所示:

Then I've wrote a very simple code, which is like follows:

#include <boost\python.hpp>       // This header used to raise error before
#include <Python.h>
using namespace std;

void main()
{
    return;
}

效果很好.然后我的好奇心使我进一步前进,我在第一篇文章中尝试了这个例子.事实证明,这135个未解决的外部错误已消失.相反,我有这个:

It works well. Then my curiosity pushed me one step further, and I tried the example in my first post. It turns out that those 135 unresolved external errors are gone. Instead, I've got this:

msvc.link.dll bin \ msvc-11.0 \ debug \ extending.pyd LINK:致命错误

msvc.link.dll bin\msvc-11.0\debug\extending.pyd LINK : fatal error

LNK1104:无法打开文件'boost_python-vc110-mt-gd-1_54.lib'

LNK1104: cannot open file 'boost_python-vc110-mt-gd-1_54.lib'

调用"C:\ Program Files(x86)\ Microsoft Visual Studio 11.0 \ VC \ vcvarsall.bat" x86

call "C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat" x86

nullink/NOLOGO/INCREMENTAL:NO/DLL/DEBUG/MACHINE:X86/MANIFEST/subsystem:console /out:"bin\msvc-11.0\debug\extending.pyd /IMPLIB:bin\msvc-11.0\debug\extengi ng.lib" /LIBPATH:C:\Python2.7.5\libs"
@"bin \ msvc-11.0 \ debug \ extending.pyd.rsp"

nullink /NOLOGO /INCREMENTAL:NO /DLL /DEBUG /MACHINE:X86 /MANIFEST /subsystem:console /out:"bin\msvc-11.0\debug\extending.pyd" /IMPLIB:"bin\msvc-11.0\debug\extendi ng.lib" /LIBPATH:"C:\Python2.7.5\libs"
@"bin\msvc-11.0\debug\extending.pyd.rsp "

    if %ERRORLEVEL% NEQ 0 EXIT %ERRORLEVEL%

...失败的msvc.link.dll bin \ msvc-11.0 \ debug \ extending.pyd

...failed msvc.link.dll bin\msvc-11.0\debug\extending.pyd

bin \ msvc-11.0 \ debug \ extending.lib bin \ msvc-11.0 \ debug \ extending.pdb ...

bin\msvc-11.0\debug\extending.lib bin\msvc-11.0\debug\extending.pdb...

...由于缺少extension.pyd而跳过了test_ext ...

...skipped test_ext for lack of extending.pyd...

msvc.link bin \ test_embed.test \ msvc-11.0 \ debug \ test_embed.exe链接:警告

msvc.link bin\test_embed.test\msvc-11.0\debug\test_embed.exe LINK : warning

LNK4001:未指定目标文件;库使用LINK:错误

LNK4001: no object files specified; libraries used LINK : error

LNK2001:无法解析的外部符号_mainCRTStartup

LNK2001: unresolved external symbol _mainCRTStartup

bin \ test_embed.test \ msvc-11.0 \ debug \ test_embed.exe:致命错误

bin\test_embed.test\msvc-11.0\debug\test_embed.exe : fatal error

LNK1120:1个未解决的外部

LNK1120: 1 unresolved externals

调用"C:\ Program Files(x86)\ Microsoft Visual Studio 11.0 \ VC \ vcvarsall.bat" x86 nul

call "C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat" x86 nul

链接/NOLOGO/INCREMENTAL:否/DEBUG/MACHINE:X86/MANIFEST/subsystem:console

link /NOLOGO /INCREMENTAL:NO /DEBUG /MACHINE:X86 /MANIFEST /subsystem:console

/出:"bin \ test_embed.test \ msvc-11.0 \ debug \ test_embed.exe"

/out:"bin\test_embed.test\msvc-11.0\debug\test_embed.exe"

/LIBPATH:"C:\ Python2.7.5 \ libs"

/LIBPATH:"C:\Python2.7.5\libs"

@"bin \ test_embed.test \ msvc-11.0 \ debug \ test_embed.exe.rsp"

@"bin\test_embed.test\msvc-11.0\debug\test_embed.exe.rsp"

    if %ERRORLEVEL% NEQ 0 EXIT %ERRORLEVEL%

...失败的msvc.link bin \ test_embed.test \ msvc-11.0 \ debug \ test_embed.exe

...failed msvc.link bin\test_embed.test\msvc-11.0\debug\test_embed.exe

bin \ test_ embed.test \ msvc-11.0 \ debug \ test_embed.pdb ...

bin\test_ embed.test\msvc-11.0\debug\test_embed.pdb...

...删除bin \ test_embed.test \ msvc-11.0 \ debug \ test_embed.pdb

...removing bin\test_embed.test\msvc-11.0\debug\test_embed.pdb

...由于缺少test_embed.exe而跳过了test_embed.run ...

...skipped test_embed.run for lack of test_embed.exe...

...无法更新5个目标...

...failed updating 5 targets...

...跳过了4个目标...

...skipped 4 targets...

很抱歉打扰您很多错误消息,我只想提供尽可能多的信息.

Sorry to bother you with a large chunk of error message, I just want to provide as more information as I can.

关于此boost_python-vc110-gd-1_54.dll,我可以在C:\local\boost_1_54_0_32bit\lib32-msvc-11.0上找到它,而我的Boost的根是C:\local\boost_1_54_0_32bit\.

About this boost_python-vc110-gd-1_54.dll, I can find it at C:\local\boost_1_54_0_32bit\lib32-msvc-11.0, while the root of my Boost is C:\local\boost_1_54_0_32bit\.

有人可以帮我解决这个问题吗?

Can anyone help me work around with this?

推荐答案

这意味着链接器无法正确链接到Python库.在尝试链接到64位Python之前,我曾遇到过这种情况.您应该尝试安装32位python,看看是否可行.

This means that the linker can't properly link to the Python lib. I have run into this before when trying to link to 64bit Python. You should try installing 32bit python and see if that works.

这篇关于无法成功安装Boost.Python的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆