How to build Boost::Python with local Python version (without sudo)
I’ve built Python and installed it to according to our instructions in How to build & install Python 3.13 without sudo.
When trying to build boost::python just with --with-python
, it can’t find the Python headers:
warning: No python installation configured and autoconfiguration
note: failed. See http://www.boost.org/libs/python/doc/building.html
note: for configuration instructions or pass --without-python to
note: suppress this message and silently skip all Boost.Python targets
In order to solve that, create tools/build/src/user-config.jam
with the following content:
using python
: 3.13
: ~/usr/bin/python3.13
: ~/usr/include/python3.13
: ~/usr/lib
;
Then, build boost::python with the following command:
./b2 install --with-python --prefix=$HOME/usr include=~/usr/include/python3.13
Remember to replace 3.13
with the actual version you installed and ~/usr
with the actual installation prefix you used.