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

Tesla Coil tescoil@irtc.net
Wed, 15 Aug 2001 17:55:36 -0500


On 15 Aug 2001, Simon Vandemoortele wrote:
> I installed Mysql-python and wondering how I am supposed
> to tell python where the modules is. There's something 
> in the FAQ about this problem [...] but I'm not sure it
> really applies to my situation.

I haven't worked with Mysql-python, but the sourceforge
rpm installs to /usr/lib/python1.5/site-packages, which
doesn't work for SuSE >= 7.0.  Then, sys.path will be 
looking at /usr/lib/python2.0/site-packages instead.
But, it's said to be 2.0 compatible--the rpm is spec'd
that way for Red Hat users, I'd guess.

You could:

import sys
sys.path.append('/usr/lib/python1.5/site-packages')

...which is a runtime-only alteration, or, you can mv
everything that was installed to 1.5 site-packages to
2.0 site-packages.  Kinda blows rpm -e, but you can
make a note of it.