Problem with .pth files under linux
Prabhu Ramachandran
prabhu at aero.iitm.ernet.in
Wed Nov 14 23:02:24 EST 2001
>>>>> "FP" == fperez <ISO-8859-1> writes:
[snip]
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 site.py so that it also searches in
/usr/local/lib/pythonX.Y/site-packages !! It does this by modifying
site.py slightly like so:
Original site.py:
prefixes = [sys.prefix]
if sys.exec_prefix != sys.prefix:
prefixes.append(sys.exec_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"))
prefixes.append(sys.exec_prefix)
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.
Nnumeric.pth:
/usr/local/lib/pythonX.Y/site-packages/Numeric
prabhu
More information about the Python-list
mailing list