ImportError: /usr/lib/libboost_python.so.1.54.0: undefined symbol: PyClass_Type

前端 未结 2 1966
天命终不由人
天命终不由人 2021-01-05 15:48

I have code written in C++:

#include 

char const* greet()
{
  return \"Yay!\";
}

BOOST_PYTHON_MODULE(libtest)
{
  using namespace b         


        
2条回答
  •  旧巷少年郎
    2021-01-05 16:09

    Use the same version of Python when building both Boost.Python and the libtest module, as well as when importing libtest.

    PyClass_Type is is part of the Python 2 C API and not part of the Python 3 C API. Hence, the Boost.Python library was likely built against Python 2. However, it is being loaded by a Python 3 interpreter, where the PyClass_Type is not available.

提交回复
热议问题