[C++-sig] import extension module in python on OSX

Wojciech Mamrak wmamrak at gmail.com
Thu Sep 12 00:54:22 CEST 2013


why didn't you follow the example to the end?

Your module is called 'hello_ext'.

2013/9/10 Simon W <simwarg at gmail.com>:
> Hello,
>
> I've compiled the example code for Boost.Python:
>
> #include <boost/python.hpp>
>
> char const* greet()
>
> {
>
>     return "hello, world";
>
> }
>
> BOOST_PYTHON_MODULE(hello_ext)
>
> {
>
>     using namespace boost::python;
>
>     def("greet", greet);
>
> }
>
>
> It compiles and I got an BoostPythonTest.dylib produced by Xcode. I've tried
> to put that file in my site-packages folder and som other places in order to
> import it into the interpreter like:
>
> import BoostPythonTest
>
> Traceback (most recent call last):
>
>   File "<stdin>", line 1, in <module>
>
> ImportError: No module named 'BoostPythonTest'
>
>>>>
>
> I've tried to rename it to BoostPythonTest.so and .pyd and so on: But it
> doesn't work. What is the proper extension name for boost python modules on
> OSX? I'm using boost 1.53, OSX 1.8 and Python 3.2
>
> Thanks in advance,
> Simon
>
> _______________________________________________
> Cplusplus-sig mailing list
> Cplusplus-sig at python.org
> https://mail.python.org/mailman/listinfo/cplusplus-sig


More information about the Cplusplus-sig mailing list