What is the correct way to install python on OS X?
Solution 1:
OS X Mavericks actually ships with Python in /usr/bin/python
:
|ruby-2.1.1| mymachine in ~
○ → /usr/bin/python --version
Python 2.7.5
You don't need to install Python at all to get started developing with Python on OS X. That version is sufficiently high enough to be useful for Python 2.x development work and not totally suck (i.e. it's not Python 2.4).
My personal preference to is to use Homebrew for installing command line tools. You get a nice, neat, compartmentalized installation that's fairly straightforward to wipe away if it bothers you. So, I would use Homebrew to install a newer version of Python if I wanted it.
To install Python with Homebrew first install Homebrew:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
And then install Python 2.7.8 with:
brew install python
As you can see, this is the 2.7.8 version of Python:
|ruby-2.1.1| mymachine in ~
○ → brew info python
python: stable 2.7.8 (bottled), HEAD
http://www.python.org
/usr/local/Cellar/python/2.7.6_1 (4976 files, 81M) *
Poured from bottle
From: https://github.com/Homebrew/homebrew/blob/master/Library/Formula/python.rb
If you'd also like Python 3.4.1 you can use:
brew install python3
Which you can see gives you:
|ruby-2.1.1| mymachine in ~
○ → brew info python3
python3: stable 3.4.1 (bottled), HEAD
https://www.python.org/
Not installed
From: https://github.com/Homebrew/homebrew/blob/master/Library/Formula/python3.rb
Homebrew will install any dependencies you need to run Python in either case.