boost.numpy编译报错:undefined reference to `PyInt_FromLong' libboost_numpy.so: undefined reference to `PyCObject_AsVoidPtr'

[ 31%] Built target boost_numpy
[ 36%] Building CXX object libs/numpy/example/CMakeFiles/dtype.dir/dtype.cpp.o
Linking CXX executable ../../../bin/dtype
CMakeFiles/dtype.dir/dtype.cpp.o: In function `boost::python::converter::arg_to_python<int>::arg_to_python(int const&)':
dtype.cpp:(.text._ZN5boost6python9converter13arg_to_pythonIiEC2ERKi[_ZN5boost6python9converter13arg_to_pythonIiEC5ERKi]+0x1c): undefined reference to `PyInt_FromLong'
../../../lib/libboost_numpy.so: undefined reference to `PyCObject_AsVoidPtr'
../../../lib/libboost_numpy.so: undefined reference to `PyCObject_Type'
collect2: error: ld returned 1 exit status
make[2]: *** [bin/dtype] Error 1
make[1]: *** [libs/numpy/example/CMakeFiles/dtype.dir/all] Error 2
make: *** [all] Error 2

这个问题的原因我也不知道,但是我是这样解决的:

下载这个版本的boost.numpy:

https://github.com/ndarray/Boost.NumPy/tree/26aaa5b62e6170f2ccde179b46f1a49c4011fc9d

原文地址:https://www.cnblogs.com/whu-zeng/p/6209077.html