Question on using distutils.core.run_setup

Terry Jones terry at
Mon Mar 17 17:57:17 CET 2008

I'm trying to programmatically install something built using distutils. I
found distutils.core.run_setup and can use it via

  >>> dist = run_setup('', ['-q', 'install'])

Is that the recommended way to do an install from inside Python (as opposed
to doing it on the command line)?

If so, how can I find where the thing(s) I installed now resides?  I saw
dist.packages but that just has top-level package names. I could __import__
these (and then use module.__file__), but that's not a good solution as it
may run code I don't want run. On my machine, I can see the packages have
been installed under the system's python2.5/site-packages directory. But
how can I determine that programmatically? I don't see anything useful on
the distutils.dist.Distribution instance I'm getting back from run_setup.



More information about the Python-list mailing list