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

W.T. Bridgman wtbridgman at radix.net
Mon Jan 26 15:13:12 EST 2004

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 

Is there a way to get distutils to generate the _mylib.so or change the 
import behavior in Python?

I examined several installers that do about what I want (like numarray 
v0.8) but they have a lot of other code whose behavior I am uncertain 

In case it matters, I'm on MacOS X 10.2.6,  SWIG 1.3.19, Python 2.3.


More information about the Distutils-SIG mailing list