Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Upgrade Python to 2.6 on Mac

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

like image 274
eozzy Avatar asked Oct 09 '09 04:10

eozzy


People also ask

How do I upgrade Python on Mac?

Let's try it out. 1. First, download an installer package from the Python website. To do that, visit https://www.python.org/downloads/ on your Mac; it detects your operating system automatically and shows a big button for downloading the latest version of Python installer on your Mac.

Does Python 2.7 come with Mac?

Mac OS X comes with Python 2.7 out of the box. In particular, you should always install Setuptools, as it makes it much easier for you to install and manage other third-party Python libraries.


2 Answers

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).

like image 61
Alex Martelli Avatar answered Oct 20 '22 19:10

Alex Martelli


Don't upgrade.

  1. Install ActivePython (which co-exists with others).
  2. Open Terminal
  3. Type python2.6
like image 28
Sridhar Ratnakumar Avatar answered Oct 20 '22 20:10

Sridhar Ratnakumar