[C++-sig] Boost Python Wrong Python Version macOS

Mortimer Hemmit mortimer.hemmit at gmail.com
Thu Sep 3 14:19:22 EDT 2020


Hello,

I am trying to build the Python library for Boost 1.74.0 on macOS
Catalina 10.15.8 with the default Clang 11.0.3. I also installed
Python 3.7.9 from python.org

I am following the instructions located at
<https://www.boost.org/doc/libs/1_74_0/more/getting_started/unix-variants.html#easy-build-and-install>
and <https://www.boost.org/doc/libs/1_74_0/libs/python/doc/html/building/installing_boost_python_on_your_.html>

I untar the archive and then execute this command in the boost directory:

./bootstrap.sh --with-python=python3.7 --with-libraries=python

This gives me output saying that it detected python 3.7.

*****BEGIN OUTPUT*****
Building Boost.Build engine with toolset clang... tools/build/src/engine/b2
Detecting Python version... 3.7
Detecting Python root... /Library/Frameworks/Python.framework/Versions/3.7
Unicode/ICU support for Boost.Regex?... not found.
Backing up existing Boost.Build configuration in project-config.jam.1
Generating Boost.Build configuration in project-config.jam for clang...

Bootstrapping is done. To build, run:

./b2

To generate header files, run:

./b2 headers

To adjust configuration, edit 'project-config.jam'.
Further information:

- Command line help:
./b2 --help

- Getting started guide:
http://www.boost.org/more/getting_started/unix-variants.html

- Boost.Build documentation:
http://www.boost.org/build/
*****END OUTPUT*****

Then, I run

sudo ./b2 --with-python

However, when it builds the libraries, it saves it with a folder path
that has 2.7, and I get files such as libboost_python27.dylib.

*****BEGIN OUTPUT*****
In file included from
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy/core/include/numpy/ufuncobject.h:327:
*****END OUTPUT*****

/System/Library is where the default macOS Python 2.7 is stored.

How can I convince Boost to use the Python 3.7 that I installed,
instead of the default Python 2.7? It looked like it detected it in
bootstrap, but it doesn't use it later. Is the way that I specified
the desired python executable correct?

Any help or guidance is greatly appreciated.

Thank you,
Mortimer


More information about the Cplusplus-sig mailing list