How to get the PYTHONPATH in shell?

后端 未结 6 589
失恋的感觉
失恋的感觉 2021-01-30 16:27
debian@debian:~$ echo $PYTHONPATH  
/home/qiime/lib/:  
debian@debian:~$ python  
Python 2.7.3 (default, Jan  2 2013, 16:53:07)   
[GCC 4.7.2] on linux2  
Type \"help\",         


        
6条回答
  •  无人及你
    2021-01-30 16:39

    Python, at startup, loads a bunch of values into sys.path (which is "implemented" via a list of strings), including:

    • various hardcoded places
    • the value of $PYTHONPATH
    • probably some stuff from startup files (I'm not sure if Python has rcfiles)

    $PYTHONPATH is only one part of the eventual value of sys.path.

    If you're after the value of sys.path, the best way would be to ask Python (thanks @Codemonkey):

    python -c "import sys; print sys.path"
    

提交回复
热议问题