如何在shell中获取pythonpath?

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","copyright","credits" or "license" for more information.  
>>> import sys  
>>> sys.path  
['','/usr/local/lib/python2.7/dist-packages/Feedparser-5.1.3-py2.7.egg','/usr/local/lib/python2.7/dist-packages/stripogram-1.5-py2.7.egg','/home/qiime/lib','/home/debian','/usr/lib/python2.7','/usr/lib/python2.7/plat-linux2','/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/lib/python2.7/dist-packages','/usr/lib/python2.7/dist-packages/PIL','/usr/lib/python2.7/dist-packages/gst-0.10','/usr/lib/python2.7/dist-packages/gtk-2.0','/usr/lib/pymodules/python2.7']

如何在bash中获取所有pythonpath输出
为什么echo $ PYTHONPATH不能得到所有的?

环境变量 PYTHONPATH实际上只添加到Python搜索模块的位置列表中。您可以像这样打印终端中的完整列表:
python -c "import sys; print(sys.path)"

或者如果要在UNIX目录列表样式中输出(由:)分隔)可以这样做:

python -c "import sys; print(':'.join(x for x in sys.path if x))"

这将输出如下内容

/usr/local/lib/python2.7/dist-packages/Feedparser-5.1.3-py2.7.egg:/usr/local/lib/
python2.7/dist-packages/stripogram-1.5-py2.7.egg:/home/qiime/lib:/home/debian:/us
r/lib/python2.7:/usr/lib/python2.7/plat-linux2:/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/lib/python2.7/dist-packages:/usr/lib/python2.7/dist-packages/PIL:/u
sr/lib/python2.7/dist-packages/gst-0.10:/usr/lib/python2.7/dist-packages/gtk-2.0:
/usr/lib/pymodules/python2.7

相关文章

普通模式 >G 增加当前行到文档末尾处的缩紧层级 $ 移动到本行的末尾 . 相当于一个...
原文连接: https://spacevim.org/cn/layers/lang/elixir/ 模块简介 功能特性 启用模块 快捷键 语言专属...
原文连接: https://spacevim.org/cn/layers/lang/dart/ 模块简介 功能特性 依赖安装及启用模块 启用模...
 =   赋值操作符,可以用于算术和字符串赋值 +        加法计算     -        减法运算...
1.根据包名来查看指定的APP指定数据 adb shell "top | grep com.xxx.xxx" 由于这样打印出来的数...
ctrl+F 向下翻页 ctrl+B 向下翻页 u 取消最近一次操作 U 取消当前行的操作 ZZ 保存当前内容并退出 gg 跳...