PYTHONPATH follies

Eric S. Raymond esr at thyrsus.com
Tue Jan 24 02:39:39 UTC 2017


Hal Murray <hmurray at megapathdsl.net>:
> >>  Some/many OS distros won't find our installed python libraries.
> > If my diagnosis is correct, you'll find that the unaltered PYTHONPATH on
> > platforms where you have this problem is pointing at something like /usr/
> > local/lib/python2.7/dist-packages - please confirm. 
> 
> Are we on the same wavelength?
> 
> My normal/unaltered PYTHONPATH is not set.

Sorry. I botched that.  Look at your sys.path, which PYTHONPATH extends.
That's what I'm saying probably points to /usr/local/lib/python2.7/dist-packages

> I'm not having any problems with waf.  My problem is running ntpq after 
> installing it.  Without setting PYTHONPATH in my environment, I get things 
> like:
>   ntpq: can't find Python NTP library -- check PYTHONPATH.
>   No module named ntp.packet
> 
> I'm pretty sure it works without it on some systems.

Yes. Here's what I think is going on:

There are two different possible assumptions about where Python user libraries
should be installed. If the sys.path in your Python installation makes the same
assumption as waf, all is good.  If not, waf lands our libries in the wrong place
and you have to set PYTHONPATH to look in that wrong place.

The two possible places are

/usr/local/lib/python2.7/dist-packages
/usr/local/lib/python2.7/site-packages

or analgogously for 2.6.
-- 
		<a href="http://www.catb.org/~esr/">Eric S. Raymond</a>


More information about the devel mailing list