Install Python, Virtualenv, Virtualenvwrapper, psycopg2, Mysql on Mac Osx

May 23, 2011 | By Regaz.

The Guide shows you How to Install and Setup a Python Django Virtualenv to Work with MySQL and ArticlereSQL Databases on macOS X.

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

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.

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

For 2.6:

curl -O

For 2.7:

curl -O

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 than after
you will insert in the .bashrc file.

nano .bashrc

Example of the lines to add:

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

Latest load the new virtualenvwrapper environment Setup:


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

Initial virtualenv Setup:

Quick Start with Python Virtualenv on macOS X:

Python-Virtualenv Quick Setup

How to Install the MySQL & PostgreSQL Adapters on Django :

Django MySQL & PostgreSQL Adapters

QuickChic Theme • Powered by WordPress