Last Updated: February 25, 2016
· celc

Setting up a python environment with virtualenv, virtualenvwrapper and pip.

This is a writeup for our designers so they can get their computers ready for our projects.

Download and install xcode from the appstore, open it. When prompted to open a project just hit cancel. Press Command + , (comma) to open preferences. Go to Downloads and install the Command Line Tools.


Open a terminal everything showing a $ sign before it is thing you type (not including $, the rest is terminal output.

We need to make sure we are using distribute instead of plain easy_install or virtualenvwrapper will break easy_install:

& curl -O && sudo python

Install pip:

$ sudo easy_install pip
Searching for pip
Best match: pip 1.2.1
Processing pip-1.2.1-py2.7.egg
pip 1.2.1 is already the active version in easy-install.pth
Installing pip script to /usr/local/bin
Installing pip-2.7 script to /usr/local/bin

Using /Library/Python/2.7/site-packages/pip-1.2.1-py2.7.egg
Processing dependencies for pip
Finished processing dependencies for pip

Check if installed:

$ pip

pip: error: You must give a command (use "pip help" to see a list of commands)

Install virtualenv:

$ sudo pip install virtualenv
Requirement already satisfied (use --upgrade to upgrade): virtualenv in /Library/Python/2.7/site-packages
Cleaning up...

Check if installed:

$ virtualenv
You must provide a DEST_DIR

Install virtualenvwrapper:

$ sudo pip install virtualenvwrapper
$ mkdir ~/.virtualenvs
$ echo "source /usr/local/bin/" >> ~/.bash_login
$ source /usr/local/bin/

Check if installed:

$ mkvirtualenv 
You must provide a DEST_DIR
Usage: virtualenv [OPTIONS] DEST_DIR

  --version             show program's version number and exit
  -h, --help            show this help message and exit
  -v, --verbose         Increase verbosity
  -q, --quiet           Decrease verbosity
  -p PYTHON_EXE, --python=PYTHON_EXE
                        The Python interpreter to use, e.g.,
                        --python=python2.5 will use the python2.5 interpreter
                        to create the new environment.  The default is the
                        interpreter that virtualenv was installed with
  --clear               Clear out the non-root install and start from scratch
  --no-site-packages    Don't give access to the global site-packages dir to
                        the virtual environment (default; deprecated)
                        Give access to the global site-packages dir to the
                        virtual environment
  --unzip-setuptools    Unzip Setuptools or Distribute when installing it
  --relocatable         Make an EXISTING virtualenv environment relocatable.
                        This fixes up scripts and makes all .pth files
  --distribute, --use-distribute
                        Use Distribute instead of Setuptools. Set environ
                        variable VIRTUALENV_DISTRIBUTE to make it the default
                        Directory to look for setuptools/distribute/pip
                        distributions in. You can add any number of additional
                        --extra-search-dir paths.
  --never-download      Never download anything from the network.  Instead,
                        virtualenv will fail if local distributions of
                        setuptools/distribute/pip are not present.
  --prompt=PROMPT       Provides an alternative prompt prefix for this

This is intended to work on mountain lion on the 2012-10-22, if something is or becomes incorrect let me know and I'll amend it.

Say Thanks