Installing modules via setuptools in a script

Thorsten Kampe thorsten at thorstenkampe.de
Mon Nov 26 03:41:19 EST 2007


* Ben Finney (Mon, 26 Nov 2007 09:04:51 +1100)
> Thorsten Kampe <thorsten at thorstenkampe.de> writes:
> > * Robert Kern (Sat, 24 Nov 2007 16:33:37 -0600)
> > > Thorsten Kampe wrote:
> > > > can anyone give me a short code snippet how to install a missing
> > > > module via setuptools (assuming setuptools is already
> > > > installed)?!
> > > 
> > > The recommended way to handle dependencies using setuptools is to
> > > specify them in the install_requires metadata in the setup()
> > > function call in your setup.py:
> > 
> > It's just a simple script - no package. So I don't even have a
> > setup.py.
> 
> The recommended way of installing a simple script that has
> dependencies is to write a setup.py for the simple script, so that you
> can declare its dependencies and have them checked on install.

Yes, I know. But this script is not going to be installed - just run. 
And therefore I'd like to know if it's possible to install missing 
dependencies in the script itself via importing setuptools. Or do I 
have to use "subprocess('easy_install')"?

Thorsten



More information about the Python-list mailing list