I'm running Mac OS X 10.8.4 (Darwin 12.4.0) with the lastest Boost distribution (1.55.0). I'm following the instructions here to build the tutorial Boost-Python project included in my distribution, and it builds fine.
Nonetheless, the output compiled libraries depend on Mac's system Python and not the anaconda Python that I'm trying to link to:
[00:20] [tutorial] $ otool -L libboost_python.dylib
libboost_python.dylib:
libboost_python.dylib (compatibility version 0.0.0, current version 0.0.0)
libpython2.7.dylib (compatibility version 2.7.0, current version 2.7.0)
/opt/local/lib/libgcc/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.18.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 169.3.0)
/opt/local/lib/libgcc/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)
[00:20] [tutorial] $ otool -L /usr/lib/libpython2.7.dylib
/usr/lib/libpython2.7.dylib:
/System/Library/Frameworks/Python.framework/Versions/2.7/Python (compatibility version 2.7.0, current version 2.7.2)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 169.3.0)
I've tried the following configurations, but none of them seem to change which Python to use:
$BOOST_ROOT/bootstrap.sh --with-python=$ANACONDA_PATH/bin/python
or
# Here, I've explicitly chosen Anaconda-provided libpython2.7.dylib
# $BOOST_ROOT/stage/lib/libboost_python.dylib refers to the dynamic
# version of boost_python.
sudo g++ -I$BOOST_ROOT -I$ANACONDA_PATH/include -L$ANACONDA_PATH/lib
-lpython2.7 $BOOST_ROOT/stage/lib/libboost_python.dylib
hello.cpp -o hello_ext.so
or
$BOOST_ROOT/bjam python=$ANACONDA_PATH/bin/python
No matter what, I'll always get this message:
[01:58] [tutorial] $ python hello.py
Fatal Python error: PyThreadState_Get: no current thread
Abort trap: 6
Here's the system Python call in comparison:
[01:58] [tutorial] $ /usr/bin/python hello.py
hello, world