相关疑难解决方法(0)

Ubuntu - 链接boost.python - 致命错误:无法找到pyconfig

有一些问题,现在我已经阅读了以下内容:

在使用boost的c ++中你好世界python扩展?

我已经尝试在我的桌面上安装boost,并按照链接方面建议的帖子完成.我有以下代码:

#include <boost/python.hpp>
#include <Python.h>
using namespace boost::python;
Run Code Online (Sandbox Code Playgroud)

现在我尝试连接以下内容:

g++ testing.cpp -I /usr/include/python2.7/pyconfig.h -L /usr/include/python2.7/Python.h
-lpython2.7
Run Code Online (Sandbox Code Playgroud)

我也尝试了以下内容:

g++ testing.cpp -I /home/username/python/include/ -L /usr/include/python2.7/Python.h -lpython2.7
Run Code Online (Sandbox Code Playgroud)

我一直收到以下错误:

/usr/include/boost/python/detail/wrap_python.hpp:50:23: fatal error: pyconfig.h: No such   
file or directory
# include <pyconfig.h>
Run Code Online (Sandbox Code Playgroud)

我不知道我哪里错了.我确实安装了boost.python,链接只是一个问题?

c++ ubuntu gcc boost boost-python

38
推荐指数
5
解决办法
4万
查看次数

Boost Python中的"没有这样的文件或目录"错误

我从ubuntu 9.04存储库安装了boost python.我从教程中成功运行 了使用Boost构建一个简单程序,所以我知道我的系统上安装了boost python.

但是,以下程序会返回错误:

#include <string>

namespace { // Avoid cluttering the global namespace.

  // A couple of simple C++ functions that we want to expose to Python.
  std::string greet() { return "hello, world"; }
  int square(int number) { return number * number; }
}
#include <boost/python.hpp>
using namespace boost::python;

BOOST_PYTHON_MODULE(getting_started1)
{
    // Add regular functions to the module.
    def("greet", greet);
    def("square", square);
}
Run Code Online (Sandbox Code Playgroud)

我尝试从以下两个步骤执行第一步来创建共享库:

g++ -c -fPIC hello.cpp -o hello.o
g++ -shared -Wl,-soname,libhello.so -o libhello.so  hello.o …
Run Code Online (Sandbox Code Playgroud)

python boost

22
推荐指数
3
解决办法
4万
查看次数

标签 统计

boost ×2

boost-python ×1

c++ ×1

gcc ×1

python ×1

ubuntu ×1