【问题标题】:Unable to build Boost.Python无法构建 Boost.Python
【发布时间】:2013-02-28 13:22:27
【问题描述】:

我正在尝试在此 link 之后构建 boost.python。 当我尝试使用./b2./bjam 进行编译时,出现如下错误:

error: No best alternative for /python_for_extensions 
next alternative: required properties: <python>2.6 <target-os>linux 
    matched 
next alternative: required properties: <python>2.6 <target-os>linux 
    matched

当我添加这一行时错误消失了:

using python : 2.6 : /usr/bin/python2.6 : /usr/include/python2.6 : /usr/lib/python2.6 : &lt;python-debugging&gt;on ;

/home/kchaitanya/boost/boost_1_50_0/tools/build/v2/user-config.jam

但是,当现在编译时,我得到了编译时错误无法找到头文件。错误的一小部分是:

 ...patience...
 ...patience...
 ...found 1548 targets...
 ...updating 62 targets...
 gcc.compile.c++ bin.v2/libs/python/build/gcc-4.1.2/release/link-static/threading multi/numeric.o

 In file included from ./boost/python/detail/prefix.hpp:13,
             from ./boost/python/numeric.hpp:8,
             from libs/python/src/numeric.cpp:6:
 ./boost/python/detail/wrap_python.hpp:50:23: error: pyconfig.h: No such file or directory
 ./boost/python/detail/wrap_python.hpp:75:24: error: patchlevel.h: No such file or directory
 ./boost/python/detail/wrap_python.hpp:78:2: error: #error Python 2.2 or higher is required for 
 ./boost/python/detail/wrap_python.hpp:142:21: error: Python.h: No such file or directory
 ./boost/python/instance_holder.hpp:34: error: ‘PyObject’ has not been declared
 ./boost/python/instance_holder.hpp:41: error: expected ‘;’ before ‘(’ token
 ./boost/python/instance_holder.hpp:45: error: ‘PyObject’ has not been declared
 ./boost/python/detail/wrapper_base.hpp:21: error: expected initializer before ‘*’ token
 ./boost/python/detail/wrapper_base.hpp:23: error: expected initializer before ‘*’ token

在构建这个 boost.python 方面需要帮助。

【问题讨论】:

  • 但是,实际上我的系统中已经安装了python对吗?
  • 我尝试安装python-devel。但是,它并不能解决我的问题。它再次给出了相同的旧错误。

标签: boost build boost-python


【解决方案1】:

问题是没有安装与我的python版本对应的python-develpython-dev包。

在我的情况下是 python2.6 所以

sudo yum install python26-devel 成功了。

【讨论】:

  • sudo yum install -y python27-devel,也试过 python2.7 pthon-2.7 都给出了相同的消息 No package python-2.7-devel available。在我的 redhat 7 上。尝试找到它:yum search python | grep -i 开发:stackoverflow.com/questions/23215535/…
【解决方案2】:

我在我的项目中遇到了类似的问题,以上没有帮助。我正在交叉编译python和boost,对我来说实际问题是配置中的'using python:'重复(一个存在于project-config.jam中,在bootstrap.sh/bat执行之后我试图添加另一个 python 配置自己到 user-config.jam)。

这里描述了这个解决方案: http://comments.gmane.org/gmane.comp.lib.boost.build/22088

这里: https://groups.google.com/forum/#!topic/boost-developers-archive/namMFSO_6Rg

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-07-08
    • 1970-01-01
    • 1970-01-01
    • 2021-08-06
    • 1970-01-01
    • 1970-01-01
    • 2023-03-03
    相关资源
    最近更新 更多