当我在IPython中打印sys.path
时,我惊讶地看到在第二个位置(sys.path[1]
)插入了python安装的bin
。你知道吗
~> /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
?这样做的目的是什么?你知道吗
对我来说没什么问题,我只是好奇。你知道吗
目前没有回答
相关问题 更多 >
编程相关推荐