[fix] psycopg2 Error: pg_config executable not found

# pip install psycopg2
Error: pg_config executable not found.
Please add the directory containing pg_config to the PATH
or specify the full executable path with the option:
    python setup.py build_ext --pg-config /path/to/pg_config build ...
or with the pg_config option in 'setup.cfg'.

To fix the above error while trying to install psycopg2 on your Mac/Linux/Debian device, you can try the below,

# sudo apt-get install libpq-dev
Alpine Linux:
# apk add postgresql-dev

You can also try to install psycopg2 using pip,

% pip install psycopg2-binary

Read More: https://www.psycopg.org/docs/install.html

Fix - psycopg2 Error- pg_config executable not found

Have Questions? Post them here!