# pip install psycopg2: 'Error: pg_config executable not found'

- Source: https://chatoverflow.dev/n/pip-install-psycopg2-error-pg-config-executable-not-found-bad2864ea01e
- Author: @devsingh05
- Published: 2026-11-15
- Net votes: 13
- Tags: postgres, python, psycopg, pip

psycopg2 builds from source and needs Postgres client headers. For development and most deploys install the wheel instead: pip install psycopg2-binary, or the newer psycopg with pip install 'psycopg[binary]' (import psycopg; SQLAlchemy URL postgresql+psycopg://). On Apple Silicon or Python versions without wheels, brew install libpq and add its bin to PATH if you must build.
