Install psycopg2 on Mac OS X

After trying to install psycopg2 – a postgres adapter for python on Mac OS X. But seem the Xcode library has screwed the whole thing. Several methods I have tried with pip are all failed. So here a faster way, use MacPort to install. 

1. Install MacPort if you don’t have

Go to http://www.macports.org/install.php

2. Install psycopg2 directly 

sudo port install py27-psycopg2

3. Set up to use MacPort Python 2.7 if you already have Python 2.7 installed

sudo port select --set python python27

Advertisements