Skip to content

Instantly share code, notes, and snippets.

@bergman
Forked from georgel/gist:2199359
Created April 17, 2012 16:42
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bergman/2407394 to your computer and use it in GitHub Desktop.
Save bergman/2407394 to your computer and use it in GitHub Desktop.
Install Python 2.7 (homebrew + pip + virtualenv) on Mac OS X Lion

Install Python

$ brew install readline sqlite gdbm
$ brew install python --universal --framework
$ python --version
Python 2.7

Symlinks...

$ brew info python
$ /usr/local/share/python/pip install --upgrade distribute

Add to .zshenv:

# Before other PATHs...
export PATH=/usr/local/share/python:$PATH

# Python
export WORKON_HOME=$HOME/.virtualenvs
export VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python2.7
export VIRTUALENVWRAPPER_VIRTUALENV_ARGS='--no-site-packages'
export PIP_VIRTUALENV_BASE=$WORKON_HOME
export PIP_RESPECT_VIRTUALENV=true
if [[ -r /usr/local/share/python/virtualenvwrapper.sh ]]; then
    source /usr/local/share/python/virtualenvwrapper.sh
else
    echo "WARNING: Can't find virtualenvwrapper.sh"
fi

Install virtualenv

$ pip install virtualenvwrapper

Test setup

$ mkvirtualenv test
$ rmvirtualenv test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment