[python-nl] howto PYTHONPATH

Floris van Manen vm at klankschap.nl
Tue May 27 22:29:15 CEST 2014


On 27 May 2014, at 16:17, Roel Bruggink <roel at fourdigits.nl> wrote:

> PYTHONPATH is een environ var en kan gebruikt worden om sys.path aan te vullen.
> Beter gezegd, te pre-penden.
> 
> Normaal gesproken gebruik je dit niet en installeer je eggs in je virtualenv, of je gebruikt zc.buildout of een combinatie van beide.
> 
> Voorbeeld:
> 
>  roel at spoon.local
>  ❯ python -c 'import sys; print sys.path'
> ['', '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip', '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7', '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin', '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac', '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages', '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk', '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old', '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload', '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages', '/Library/Python/2.7/site-packages']
> 
>  roel at spoon.local
>  ❯ PYTHONPATH=/henk python -c 'import sys; print sys.path'
> ['', '/henk', '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip', '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7', '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin', '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac', '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages', '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk', '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old', '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload', '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages', '/Library/Python/2.7/site-packages']
> 
> 
> Zie ook http://www.stereoplex.com/blog/understanding-imports-and-pythonpathen https://docs.python.org/2/using/cmdline.html#envvar-PYTHONPATH
> 


Dat heb ik allemaal wel begrepen.
Ook de werking en dat je er zelf dingen aan toe kunt voegen en alles.

Wat ik niet kan thuisbrengen is hoe die /System en /Library entries opduiken.
En op die plek.
(En hoe ik ze weer weg kan krijgen)


.F



More information about the Python-nl mailing list