[Tutor] How does python find the modules I install ???

dman dsh8290@rit.edu
Wed, 15 Aug 2001 23:57:39 -0400

On Wed, Aug 15, 2001 at 10:33:44PM -0500, Timothy Wilson wrote:
| On Wed, 15 Aug 2001, dman wrote:
| > You only need to make sure that the modules are in $PYTHONPATH (which
| > at runtime translates to sys.path).  Usually the default directory is
| > /usr/lib/python<version>/lib so if you put the modules there it should
| > work.  (BTW the RPM should have put them there for you, if not it is a
| > bug in the RPM and the maintainer should be bugged and you need to
| > change it for your system).
| I prefer to keep a directory for extra modules in my /home so it won't be
| blown away in a system upgrade (or other non-planned problem). Another
| alternative would be /usr/local/share if you have others on the system that
| would like to access the modules too.

Simply add that directory to your $PYTHONPATH environment variable
before running python or add the path to sys.path in a python script.