Setup Python on OSX

Python is already installed on OS X and it's relatively easy to install both pip and virtualenv.

Install Pip

sudo easy_install pip

Install Virtualenv

sudo pip install virtualenv

Now that virtualenv and pip are installed, let's test out virtualenv to make sure that it's working. We've already tested pip installing virtualenv.

Testing virtualenv

Open a terminal and navigate to some directory under your home (assuming /User/monty/code)

You should now have an active virtualenv which is separate from the system libraries. Your command prompt should look something like

(env_test)montys-MacBook-Pro:code monty$ 

You can install whatever you want in the new virtualenv using pip:

(env_test)montys-MacBook-Pro:code monty$ pip install pytest
Downloading/unpacking pytest
  Downloading (527kB): 527kB downloaded
  Running egg_info for package pytest
Downloading/unpacking py>=1.4.12 (from pytest)
  Downloading (227kB): 227kB downloaded
  Running egg_info for package py
Installing collected packages: pytest, py
  Running install for pytest
    Installing py.test script to /Users/monty/code/env_test/bin
    Installing py.test-2.6 script to /Users/monty/code/env_test/bin
  Running install for py
Successfully installed pytest py
Cleaning up...

SetupPythonOnOsX (last edited 2012-12-11 06:00:20 by tim)