Install Python, virtualenv, virtualenvwrapper, psycopg2, mysql on Mac osx

May 23rd, 2011 by Regaz

The Guide Shows You How-to Install and Setup a Python Django Virtualenv to Work with MySQL and ArticlereSQL Databases on Mac OS X.

The tutorial make use of pip, virtualenv and virtualenvwrapper to Configure Python Virtualenvs for Mac OS X.

The Content is Expressly Reduced to Give Focus Only to Essential and Practical Steps and Commands :)

Python Apple

A) Installing Python

Download your Python’s Version:
Python 2.5
Python 2.6
Python 2.7

After locate each .dmg Packages in Finder and Double Click to Mount.
Once Mounted you provide to Install Sequentially all Python Versions.
Leave all the Defaults and wait until the process will Succeed.

Next check that the PATH is Set as to permit you an easy Python’s Version switching.

cd $HOME
cat .bashrc

If in the Output you find an Entry about Python containing “Versions/Current” you are set at Best so you can follow to point B)
Instead if it’s Set as “Versions/2.x” proceed to:
1) Automatic symlinking by the pythonselect script on Current directory:

sudo pythonselect 2.x

2) Change your path to the Current version
Find the value to insert on the .bashrc:

dirname `which python`

Copy the output and replace in .bashrc the section containing
the “Versions/2.x” reference with:

nano .bashrc

When you are done save and leave nano typing “ctrl+x”

To switch between multiple Python’s versions look at: Change Python’s Version

B)Install Setuptools.

We will use for downloading curl, to install it look at here: Installing Curl
1)So choose the right version for the correspondent Python:
For 2.5:

curl -O http://pypi.python.org/packages/2.5/s/setuptools/setuptools-0.6c11-py2.5.egg

For 2.6:

curl -O http://pypi.python.org/packages/2.6/s/setuptools/setuptools-0.6c11-py2.6.egg

For 2.7:

curl -O http://pypi.python.org/packages/2.7/s/setuptools/setuptools-0.6c11-py2.7.egg

2) Install it with:

sudo sh setuptools*.egg

C) Install pip

sudo easy_install pip

D) Install virtualenv

sudo pip install virtualenv

E) Install virtualenvwrapper

sudo pip install virtualenvwrapper

Look to the output and find the location of the utility virtualenvwrapper.sh than after
you will insert in the .bashrc file.

nano .bashrc

Example of the lines to add:

export PIP_RESPECT_VIRTUALENV=true
export WORKON_HOME=$HOME/.virtualenv
source /Library/Frameworks/Python.framework/Versions/2.5/bin/virtualenvwrapper.sh

Latest load the new virtualenvwrapper environment Setup:

source .bashrc

If you haven’t any error signaled on output you are Done :)

Initial virtualenv Setup:

virtualenvwrapper.sh

Quick Getting-Started with Python Virtualenv on Mac OS X:

Python-Virtualenv Quick Setup

How-to Install the MySQL & PostgreSQL Adapters on Django :

Django MySQL & PostgreSQL Adapters

(Visited 7 times, 1 visits today)
Share on Tumblr

Tags: , , , , , , , ,


No Responses to “Install Python, virtualenv, virtualenvwrapper, psycopg2, mysql on Mac osx”

  1. MozelTech says:

    How do I find where it is mounted….Its driving me insane. Does not seem to be in /media/ or /mnt/

    Any Help would be appreciated!

  2. Anonymous says:

    thanks :)