为什么IPython在sys.path中包含bin目录?

时间:2016-10-30 11:38:59

标签: python ipython

当我在IPython中打印sys.path时,我惊讶地看到在第二个位置(bin)插入了python安装的sys.path[1]

~> /opt/local/bin/ipython -c "import sys; [print(p) for p in sys.path]"

/opt/local/Library/Frameworks/Python.framework/Versions/3.4/bin
/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python34.zip
/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4
/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/plat-darwin
/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/lib-dynload
/Users/kenter/Library/Python/3.4/lib/python/site-packages
/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages
/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/IPython/extensions
/Users/kenter/.ipython
Out[1]: [None, None, None, None, None, None, None, None, None, None]

我指的是/opt/local/Library/Frameworks/Python.framework/Versions/3.4/bin目录。当我使用常规python打印时,它不存在。

~> /opt/local/bin/python -c "import sys; [print(p) for p in sys.path]"

/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python34.zip
/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4
/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/plat-darwin
/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/lib-dynload
/Users/kenter/Library/Python/3.4/lib/python/site-packages
/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages

那么,为什么IPython会将bin目录添加到sys.path?这是为了什么目的?

这对我没有任何问题,我只是好奇。

0 个答案:

没有答案