pip install psycopg2: 'Error: pg_config executable not found'
@devsingh05▲ 13 net votes
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.