Problem with .pth files under linux

Prabhu Ramachandran prabhu at
Thu Nov 15 05:02:24 CET 2001

>>>>> "FP" == fperez  <ISO-8859-1> writes:


    FP> So the point is, your .pth files have to be in your normal
    FP> site-packages hierarchy. But my problem is that my python is
    FP> installed in /usr, but I also have a
    FP> /usr/local/lib/python2.1/site-packages directory where I put
    FP> things I get off the web. I like it that way because when I
    FP> upgrade linux, I can just let the installer wipe /usr and all
    FP> the things I have in /usr/local remain.

    FP> Since the searcher will only expand on sys.prefix and
    FP> sys.exec_prefix (and it's a *bad* idea changing these to
    FP> anything that's not your real python directory), things that
    FP> are not under that will not be easily found (as .pth files).

Hmm.  This is the reason why Debian as a Linux distro rocks.  Debian
modifies so that it also searches in
/usr/local/lib/pythonX.Y/site-packages !! It does this by modifying slightly like so:


prefixes = [sys.prefix]
if sys.exec_prefix != sys.prefix:

Debian's version:

prefixes = [os.path.join(sys.prefix, "local"), sys.prefix]
if sys.exec_prefix != sys.prefix:
    prefixes.append(os.path.join(sys.exec_prefix, "local"))

Obviously very thoughtful, correct and convenient. :)

Another work around in your case would be to stick your Numeric.pth
alone (with an absolute path) inside /usr/lib/pythonX.Y/site-packages.



More information about the Python-list mailing list