I eventually got around to updating all my Macs to 10.7 in what ended up being a few days before 10.8 was released. (I do realize the ridiculousness of the phrase “all my Macs”.) In changing over to the then-new version of OSX, I decided I wanted to be more intentional in setting up my Python environment, and specifically to use 2.7.3 for scripting and web dev, and to standardize this across machines. To do this, I use homebrew.
There is a page on the homebrew wiki that explains how
brew handles installing Python and its package managers
pip. Following the instructions, including prefixing your PATH with
/usr/local/share/python, is supposed to leave you with both
pip installing packages for Python2.7, without the need to use
sudo. It didn’t work for me. So, here’s the simple fix I had to make to get
easy_install) working correctly:
If you type
which pip at a bash prompt, and followed the instructions correctly, you’ll find it (and
/usr/local/bin. If you open that file in your favorite text editor, though, you’ll find a shebang line at the top:
that points pip to the system python. Edit that line to:
#! /usr/bin/env python
and pip will then correctly install packages for homebrew’s Python instead of system Python. I banged my head against the wall for a while trying to get pip to install packages correctly, until I thought to look at the
pip file itself. Maybe now you won’t have to do that.