If you install multiple versions of python (I currently have the default 2.5, installed 3.0.1 and now installed 2.6.2), it automatically puts stuff in /usr/local
, and it also adjusts the path to include the /Library/Frameworks/Python/Versions/theVersion/bin
, but whats the point of that when /usr/local
is already on the PATH, and all installed versions (except the default 2.5, which is in /usr/bin
) are in there? I removed the python framework paths from my PATH in .bash_profile
, and I can still type "python -V" => "Python 2.5.1"
, "python2.6 -V" => "Python 2.6.2"
,"python3 -V" => "Python 3.0.1"
. Just wondering why it puts it in /usr/local
, and also changes the PATH. And is what I did fine? Thanks.
Also, the 2.6 installation made it the 'current' one, having .../Python.framework/Versions/Current
point to 2.6., So plain 'python' things in /usr/local/bin
point to 2.6, but it doesn't matter because usr/bin
comes first and things with the same name in there point to 2.5 stuff.. Anyway, 2.5 comes with leopard, I installed 3.0.1 just to have the latest version (that has a dmg file), and now I installed 2.6.2 for use with pygame.
EDIT: OK, here's how I understand it. When you install, say, Python 2.6.2:
A bunch of symlinks are added to /usr/local/bin
, so when there's a #! /usr/local/bin/python
shebang in a python script, it will run, and in /Applications/Python 2.6
, the Python Launcher is made default application to run .py files, which uses /usr/local/bin/pythonw
, and /Library/Frameworks/Python.framework/Versions/2.6/bin
is created and added to the front of the path, so which python
will get the python in there, and also #! /usr/bin/env python
shebang's will run correctly.
pyenv is a Python version management tool. It allows you to install multiple versions of Python and easily switch between them. To install, follow these instructions (or see the full installation instructions on the official GitHub repository): Install using brew: brew install pyenv.
If you wish to use multiple versions of Python on a single machine, then pyenv is a commonly used tool to install and switch between versions. This is not to be confused with the previously mentioned depreciated pyvenv script. It does not come bundled with Python and must be installed separately.
There's no a priori guarantee that /usr/local/bin will stay on the PATH (especially it will not necessarily stay "in front of" /usr/bin!-), so it's perfectly reasonable for an installer to ensure the specifically needed /Library/.../bin directory does get on the PATH. Plus, it may be the case that the /Library/.../bin has supplementary stuff that doesn't get symlinked into /usr/local/bin, although I believe that's not currently the case with recent Mac standard distributions of Python.
If you know that the way you'll arrange your path, and the exact set of executables you'll be using, are entirely satisfied from /usr/local/bin, then it's quite OK for you to remove the /Library/etc directories from your own path, of course.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With