Appending to sys.path during module install with distutils
Darren Hart
darren at dvhart.com
Sun Oct 30 17:04:30 EDT 2011
I'm trying to use distutils to install a collection of modules in
/usr/local/lib/python2.7/site-packages. My distribution (Fedora 15)
doesn't include any /usr/local paths in sys.path, so the import fails
when running the program. The distutils documentation suggests adding
a $NAME.pth file to an existing site-packages directory in sys.path.
Is there a preferred/accepted method of doing this?
I considered just adding some code to my setup.py to generate a
braindump.pth file containing something like:
PREFIX/lib/pythonMAJOR.MINOR/site-packages
and then walking the existing sys.path and picking one of those
site-packages directories to install braindump.pth to. I'm not sure
how to determine which is the appropriate path.
Maybe I'm going about this completely wrong as well - anyone care to
help steer me in the right direction?
The project is located here: http://braindump.dvhart.com in case
anyone wants it for reference.
Thanks,
--
Darren Hart
More information about the Python-list
mailing list