|
1 | 1 | Mac OS X |
2 | 2 | ======== |
| 3 | + |
| 4 | +*Or, "Installing Python 2.7 via Homebrew".* |
| 5 | + |
| 6 | +Package Manager |
| 7 | +--------------- |
| 8 | + |
| 9 | +While Snow Leopard comes with a large number of UNIX utilities, those |
| 10 | +familiar with Linux systems will notice one key component missing: a |
| 11 | +package manager. Mxcl's `Homebrew <http://mxcl.github.com/homebrew/>`_ is the answer. |
| 12 | + |
| 13 | +To `install Homebrew <https://github.com/mxcl/homebrew/wiki/installation>`_, simply run: :: |
| 14 | + |
| 15 | + $ ruby -e "$(curl -fsS https://raw.github.com/gist/323731)" |
| 16 | + |
| 17 | + |
| 18 | +It's basic commands are **update**, **install**, and **remove**. |
| 19 | + |
| 20 | +.. man brew |
| 21 | +
|
| 22 | +
|
| 23 | +And we can now install Python 2.7: :: |
| 24 | + |
| 25 | + $ brew install python --framework |
| 26 | + |
| 27 | + |
| 28 | +The ``--framework`` option tells Homebrew to compile a Framework-style Python build, rather than a UNIX-style build. The outdated version of Python that Snow Leopard comes packaged with |
| 29 | +is built as a Framework, so this helps avoid some future module installation |
| 30 | +bugs. |
| 31 | + |
| 32 | +*Don't forget to update your environment PATH.* |
| 33 | + |
| 34 | +Building From Source |
| 35 | +-------------------- |
| 36 | + |
| 37 | +.. todo:: Write "Building From Source" |
| 38 | + |
| 39 | + |
| 40 | +Distribute & Pip |
| 41 | +---------------- |
| 42 | + |
| 43 | +*Distribute* is a fantastic drop-in replacement for *easy_install* and |
| 44 | +*setuptools*. It allows you to install and manage python packages from |
| 45 | +pypi.python.org, amongst a few other sources. It also plays well with |
| 46 | +*virtualenv* and user-enviornments. |
| 47 | + |
| 48 | +**easy_install** is considered by many to be a deprecated system, so we |
| 49 | +will install it's replacement: **pip**. Pip allows for uninstallation |
| 50 | +of packages, and is actively maintained, unlike setuptool's easy_install. |
| 51 | + |
| 52 | +To install *pip* and Distribute's *easy_install*: |
| 53 | + |
| 54 | +If you have homebrew: :: |
| 55 | + |
| 56 | + $ brew install pip |
| 57 | + |
| 58 | +...And, if you're a masochist: :: |
| 59 | + |
| 60 | + $ curl -O http://python-distribute.org/distribute_setup.py |
| 61 | + $ python distribute_setup.py |
| 62 | + |
| 63 | + $ easy_install pip |
| 64 | + |
| 65 | +Hopefully you'll never have to use **easy_install** again. |
| 66 | + |
| 67 | + |
| 68 | +Updating Python |
| 69 | +--------------- |
| 70 | + |
| 71 | +Homebrew makes it simple. :: |
| 72 | + |
| 73 | + $ brew update |
| 74 | + $ brew install --force python |
| 75 | + |
0 commit comments