[Distutils] Newbie Q:Why no _mylib.so?

Pearu Peterson pearu at cens.ioc.ee
Tue Jan 27 05:06:15 EST 2004


On Mon, 26 Jan 2004, W.T. Bridgman wrote:

> I've made a C-extension python wrapper with SWIG and now want to make a 
> distutils script to compile & install it.  Note I am *NOT* trying to 
> let distutils build the SWIG wrapper (at least not yet).
> 
> I can successfully build the extension from the command line and access 
> it from python but one of the problems I've encountered is that when 
> distutils builds the library, it comes out as myllib.so, not _mylib.so. 
>   Python insists on importing _mylib and SWIG seems determined to 
> generate code for a target _mylib.so.  I'm also having problems getting 
> distutils to place the _mylib.so and mylib.py files in the proper 
> locations.
> 
> Is there a way to get distutils to generate the _mylib.so or change the 
> import behavior in Python?

Use Extension('_mylib',..) instead of Extension('mylib',..) in your
setup.py file.

Pearu




More information about the Distutils-SIG mailing list