Appending to sys.path during module install with distutils

D

Darren Hart

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,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top