[Django]-Install psycopg2 failing python 3.7

4👍

Instead of pip install psycopg2 try to run pip install psycopg2-binary.

0👍

psycopg2 is a wrapper around the libpq C library, and so it requires that library (plus other pre-requisites) to be installed before you can successfully run pip install psycopg2. The errors you see is probably related to that.

There’s an alternative, which is to use the psycopg2-binary wheel package, which comes pre-packaged with its own version of C libraries (including libpq), meaning you don’t need to go through all the pre-requisite steps.

$ pip install psycopg2-binary

The only cavaet is that psycopg2-binary is not recommended to be used in production environments.

👤d4nyll

0👍

This works for me:

pip install psycopg2-binary --user

Leave a comment