Install psycopg2 on Ubuntu Install psycopg2 on Ubuntu postgresql postgresql

Install psycopg2 on Ubuntu


This works for me in Ubuntu 12.04 and 15.10

if pip not installed:

sudo apt-get install python-pip

and then:

sudo apt-get updatesudo apt-get install libpq-dev python-devsudo pip install psycopg2


Using Ubuntu 12.04 it appears to work fine for me:

jon@minerva:~$ sudo apt-get install python-psycopg2[sudo] password for jon: Reading package lists... DoneBuilding dependency tree       Reading state information... DoneSuggested packages:  python-psycopg2-docThe following NEW packages will be installed  python-psycopg20 upgraded, 1 newly installed, 0 to remove and 334 not upgraded.Need to get 153 kB of archives.

What error are you getting exactly? - double check you've spelt psycopg right - that's quite often a gotcha... and it never hurts to run an apt-get update to make sure your repo. is up to date.


Use

sudo apt-get install python3-psycopg2

for Python3 )