PYTHONPATH follies

Hal Murray hmurray at megapathdsl.net
Tue Jan 24 12:10:28 UTC 2017


esr at thyrsus.com said:
> 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

That general idea seems reasonable, but there are more than 2 possibilities.

>From NetBSD

>>> print sys.path
['', '/usr/local/lib/python2.7/site-packages', '/usr/pkg/lib/python27.zip', 
'/usr/pkg/lib/python2.7', '/usr/pkg/lib/python2.7/plat-netbsd6', 
'/usr/pkg/lib/python2.7/lib-tk', '/usr/pkg/lib/python2.7/lib-old', 
'/usr/pkg/lib/python2.7/lib-dynload', '/usr/pkg/lib/python2.7/site-packages']

(The site-packages in the second slot is from my PYTHONPATH)

Note the /usr/pkg/lib rather than /usr/local/lib/ in the last slot.

>From FreeBSD
['', '/usr/local/lib/python2.7/site-packages', '/usr/local/lib/python27.zip', 
'/usr/local/lib/python2.7', '/usr/local/lib/python2.7/plat-freebsd10', 
'/usr/local/lib/python2.7/lib-tk', '/usr/local/lib/python2.7/lib-old', 
'/usr/local/lib/python2.7/lib-dynload']



-- 
These are my opinions.  I hate spam.





More information about the devel mailing list