A related/similar post on Windows is https://stackoverflow.com/questions/44153858/linking-against-boost-python-3-6-cant-find-boost-python-instead-of-boost-pytho
As I had set using python 3.9, but ld will always tried to link libboost_python instead of libboost_python3.9 I also checked the header /usr/include/boost/python/detail/config.hpp It shows #define BOOST_LIB_NAME BOOST_PYTHON_CONCAT(boost_python, PY_MAJOR_VERSION, PY_MINOR_VERSION) I suspect this package won't work properly out the PY_MAJOR_VERSION and PY_MINOR_VERSION defined in /usr/include/python3.9/Python.h