[C++-sig] Linking Boost-Python to Python Library in OS X and Anaconda Python 3.5

Jon Lederman jonlederman at gmail.com
Wed May 25 13:41:57 EDT 2016


Hi,

I am having some issues using boost-python on OS X using Anaconda Python 3.5.  I am able to build a simple c++ function using boost-python and call it from Python.  However, when I create a simple class and call the constructor, I am met with:

In [2]: hello_ext.World()
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-2-514fe5345d15> in <module>()
----> 1 hello_ext.World()

TypeError: __init__() should return None, not ‘NoneType'

From what I understand, this means that I have linked boost-python.  against an incompatible version of Python.  I thought I had build boost-python correctly (I have built directly using bjam and have tried binaries from Anaconda).  However, when I try to see what Python libraries are linked against boost-python, I don’t see any reference to any Python libraries:

boost_python_test Jon$ otool -L /Users/Jon/anaconda/envs/my-env/lib/libboost_python3.dylib
/Users/Jon/anaconda/envs/my-env/lib/libboost_python3.dylib:
	@rpath/./libboost_python3.dylib (compatibility version 0.0.0, current version 0.0.0)
	/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 52.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 159.1.0)

Shouldn’t a call to otool show me which Python library was linked to boost-python?  And, if none is reported what does that mean?  

Any help with the above issues would be greatly appreciated.

Thanks.

-Jon


More information about the Cplusplus-sig mailing list