boost - 无法构建 Boost.Python

标签 boost build boost-python

我正在尝试构建boost.python遵循此link 。 当我尝试使用 ./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 : <python-debugging>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-develpython-dev 包。

就我而言,它是 python2.6 所以

sudo yum install python26-devel 成功了。

关于boost - 无法构建 Boost.Python,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15136671/

相关文章:

c++ - 为什么 PyGILState_Release 抛出致命的 Python 错误

c++ - std::string::empty 的 undefined symbol 错误; Mac OS High Sierra 上的 c++ 标准方法链接错误

c - 安装第 3 方库以在我的 C 程序中使用

maven - 如何从 go lang 代码运行 maven 构建

android - Problemas build Cordova 项目

python - boost::python:使用回调

c++ - 使用 cv::Mat boost Python 包装器和 OpenCv 参数错误

c++ - "runnable thread"与 I/O 完成端口的 "NumberOfConcurrentThreads"相关的定义是什么?

c++ - enable_shared_from_this - 空的内部弱指针?

c++ - 无法使用包装不同下一层的两个 ssl_stream 编译代码