Installing psycopg2 in Ubuntu in a virtualenvironment

On a fresh Ubuntu install under a virtualenvironment if you try to

pip install psycopg2

you will get this error: error: command ‘gcc’ failed with exit status 1
It is quite annoying but there is a quick and easy fix.
type this into your terminal

sudo apt-get install python-setuptools python-all-dev build-essential

This will install a bunch of stuff and now if you try

pip install psycopg2

you should see a bunch of compilation messages and finally a message saying

Successfully installed psycopg2
Cleaning up…

Viola :)

About these ads

One thought on “Installing psycopg2 in Ubuntu in a virtualenvironment

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