Error: command 'gcc' failed with exit status when installing psycopg2 Error: command 'gcc' failed with exit status when installing psycopg2 python python

Error: command 'gcc' failed with exit status when installing psycopg2


You'll need to install the development package for PostgreSQL, which for instance under Ubuntu is a sudo apt-get install libpq-dev... and for CentOS it's yum install postgresql-devel


For the case of CentOS, I had this very same problem, that I solved installing these packages:

sudo yum install postgresql-libssudo yum install postgresql-develsudo yum install python-devel

only then, I was able to perform successfully:

sudo easy_install psycopg2


May Your system is missing the Python headers. To fix this, run:

sudo apt-get install python-dev

or

sudo apt-get install python3-dev