I'd like to upgrade the default python installation (2.5.1) supplied with OS X Leopard to the latest version. Please let me know how I can achieve this.
Thanks
I'd like to upgrade the default python installation (2.5.1) supplied with OS X Leopard to the latest version. Please let me know how I can achieve this.
Thanks
May I suggest you leave the "Default" be, and install Python in /usr/local/bin.
done.
Since /usr/local/bin comes before /usr/bin in the $PATH, you will invoke 2.6 when you type python, but the OS will remain stable...
I believe there are a few options. The one I like is to install alternative UNIX software on my Macs using MacPorts, http://www.macports.org/ -- this way the new software is installed in a different directory and won't mess up anything depending on the apple-installed version, and macports also has a nice way of keeping their installed software up to date. I believe MacPorts helps take care of dependencies as well.
You have a number of options
Install with MacPorts or Fink, e.g.:
sudo port install python2.6
Install from source:
tar xzvf Python-2.6.3.tgz
cd Python-2.6.3
./configure && make && sudo make install
When an OS is distributed with some specific Python release and uses it for some OS functionality (as is the case with Mac OS X, as well as many Linux distros &c), you should not tamper in any way with the system-supplied Python (as in, "upgrading" it and the like): while Python strives for backwards compatibility within any major release (such as 2.*
or 3.*
, this can never be 100% guaranted; your OS supplied tested all functionality thoroughly with the specific Python version they distribute; if you manage to alter that version, "on your head be it" -- neither your OS supplier nor the PSF accepts any responsibility for whatever damage that might perhaps do to your system.
Rather, as other answers already suggested, install any other release you wish "besides" the system one -- why tamper with that crucial one, and risk breaking things, when installing others is so easy anyway?! On typical Mac OS X 10.5 machines (haven't upgraded any of my several macs to 10.6 yet), I have the Apple-supplied 2.5, a 2.4 on the side to support some old projects not worth the bother to upgrate, the latest 2.6 for new stuff, 3.1 as well to get the very newest -- they all live together in peace and quiet, I just type the release number explicitly, i.e. using python2.6
at the prompt, when I want a specific release. What release gets used when at the shell prompt you just say python
is up to you (I personally prefer that to mean "the system-supplied Python", but it's a matter of taste: by setting paths, or shell aliases, &c, you can make it mean whatever you wish).
Don't upgrade.
python2.6
The best is to use macports (just like Adam Rosenfield stated on this thread).
If you also use the Python2.5 that also comes from macports you can easily switch between versions using the *python_select*.
# installation
sudo port install python_select
# to switch to python2.5
sudo python_select python25
# to switch to python2.6
sudo python_select python26
The standard http://python.org install for Mac OSX will happily coexist with the "system python". If you let the installer change your paths, when you run python from a prompt in terminal, it will find the version at
/Library/Frameworks/Python.framework/Versions/2.6/bin/python
However, this won't interfere with anything that OSX itself does with python, which correctly hardwires the path to the version that it installs.