How to get the PYTHONPATH in shell?

后端 未结 6 600
失恋的感觉
失恋的感觉 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:34

    Adding to @zzzzzzz answer, I ran the command:python3 -c "import sys; print(sys.path)" and it provided me with different paths comparing to the same command with python. The paths that were displayed with python3 were "python3 oriented".

    See the output of the two different commands:

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

    ['', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/local/lib/python2.7/dist-packages/setuptools-39.1.0-py2.7.egg', '/usr/lib/python2.7/dist-packages']

    python3 -c "import sys; print(sys.path)"

    ['', '/usr/lib/python36.zip', '/usr/lib/python3.6', '/usr/lib/python3.6/lib-dynload', '/usr/local/lib/python3.6/dist-packages', '/usr/lib/python3/dist-packages']

    Both commands were executed on my Ubuntu 18.04 machine.

提交回复
热议问题