Error:
# 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,
Ubuntu:
# sudo apt-get install libpq-dev
macOS:
% brew install postgresql
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

Provide Feedback For This Article
We take your feedback seriously and use it to improve our content. Thank you for helping us serve you better!
😊 Thanks for your time, your feedback has been registered!
Comments & Discussion
Facing issues? Have questions? Post them here! We're happy to help!