On my OS X typing /usr/bin/python in to terminal runs Python 2.6.1, but typing python runs Python 2.7.2. I'd like the former to run 2.7.2 as well - how do I do this?
The version in /usr/bin/python is the version installed as part of OS X. Type 'which python' to find out where your newer python version is located. You've probably installed a newer version via MacPorts or the like.
It might be dangerous to change where /usr/bin/python points to in case it is needed by other apps. You can change your python scripts so that they find the user's version of python by changing the first line from:
If you really want to replace /usr/bin/python, you can do it like this:
However, like I said, that might be dangerous. If you need to revert this change later you can run:
Please run these with care though. If you accidentally remove your system installed python version on OS X there will be some pain involved in getting it back.
It seems the
The file itself seems to be pointing to (Reference 1):
In this folder you should be able to find the latest installed 2.x or 3.x versions with symbolic link folder named Current/, where Current/ will point to the latest installed version.
Note, all the Python version that you have ever installed are placed in (Reference 2):
In my case I had to remove 2.5 folder from 'Reference 1' and upload 2.7 from 'Reference 2'. Then I removed the 'Current' link and created a new one pointing to 2.7/ folder (ln -s 2.7/ Current). [I am not sure, the same might be needed for the other folder]
Now, when typing python --version you should see python version pointing to the latest Current/ link that you created, in my case it was Version 2.7.
I hope this helped, it worked here.