Python Virtualenv on OSX

This subject looks easy and simple. However I will introduce the work flow in this post if it means something.

Part I: Use Port to install Python on OSX

sudo port install python26 python_select
sudo port select --set python python26

OR

sudo port install python30 python_select
sudo port select --set python python30

(Do sudo apt-get install python-setuptools python-dev build-essential on Linux)

sudo port install -U pip

Part II: Create virtualenv

sudo easy_install -U pip
sudo easy_install -U virtualenv
virtualenv myenv
$ virtualenv –-python=/usr/bin/python2.7 myenv-py27
$ source /tmp/myenv/bin/activate
$ pip install yolk
$ source /tmp/myenv/bin/activate
$ yolk -l
$ deactivate
$ source /tmp/myenv/bin/activate
$ pip freeze > /tmp/requirements.txt
$ source /tmp/myenv/bin/activate
$ pip uninstall Django

A very useful reference.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s