Installing pip and virtualenv on Mac

These instructions show how to install pip and virtualevn on a Mac running Snow Leopard 10.6.8 and using Python 2.7. I used this to install Django 1.3.1 (installation instructions included).

Installing pip

(skip if you have pip installed)

First make sure you have either setuptools or distribute installed. Please consult your operating system’s package manager or install it manually:

curl http://python-distribute.org/distribute_setup.py | python

Now install pip:

sudo curl https://raw.github.com/pypa/pip/master/contrib/get-pip.py | python

Install virtualenv

(skip if you have virtualenv already)

Install virtualenv:

pip install virtualenv

Install Django using pip and virtualenv

Create a directory for a new django project:

mkdir djangoproject
cd djangoproject

Create a virtual environment in a subdirectory (I'm using name "venv"):

virtualenv venv --no-site-packages

Activate the virtual environment

cd venv
source bin/activate
which python

Install django in the virtual environment using pip:

pip install django

That's it. You can test the installation (if no errors django was installed):

$ python
>>> import django
>>>

Now continue with the tutorial on the Django site (version 1.3): https://docs.djangoproject.com/en/1.3/intro/tutorial01/

5 thoughts on “Installing pip and virtualenv on Mac”

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.