When I printed the sys.path
in IPython I was surprised to see the bin
of the python installation inserted at the second position (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]
I'm referring to the /opt/local/Library/Frameworks/Python.framework/Versions/3.4/bin
directory. It is not present when I print it using the regular 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
So, why does IPython add the bin
directory to the sys.path
? What's the purpose of this?
It doesn't cause any problems for me, I'm just curious.