

(virtualenv) C:\virtualenv\Scripts\> easy_install psycopg2-2.5.win32-py2.7-pg9.2.4-release.exeįor Python 3 you should use sudo apt-get install libpq-dev python3-dev under Debian. To install the native binary in a virtual envrionment, use easy_install: C:\virtualenv\Scripts\> activate.bat The easiest install is using a windows executable binary. I recently configured psycopg2 on a windows machine. If you're on a mac you can use homebrew brew install postgresql

Sudo PATH=$PATH:/Applications/Postgres.app/Contents/Versions/9.3/bin pip install psycopg2
#Pip install psycopg2 code#
On Mac Mavericks with Postgres.app version 9.3.2.0 RC2 I needed to use the following code after installing Postgres: That was the solution on CentOS 6 at least. On CentOS, you need the postgres dev packages: sudo yum install python-devel postgresql-devel Or sudo apt install postgresql-server-dev-allĪs well before installing psycopg2 again. If that's not enough, try sudo apt install build-essential Python 2 1 sudo apt install libpq-dev python-dev You might need to install python3.8-dev or similar for e.g. Install the prerequsisites for building the psycopg2 package from source: Debian/Ubuntu Python 3 sudo apt install libpq-dev python3-dev Install the psycopg2-binary PyPI package instead, it has Python wheels for Linux and Mac OS. Below are solutions for Linux, Mac users, since lots of them find this post through web searches. Note: Since a while back, there are binary wheels for Windows in PyPI, so this should no longer be an issue for Windows users.
