Home >Backend Development >Python Tutorial >Why Can't Psycopg2 Find pg_config Even Though It's in My PATH?
pg_config Executable Not Found during psycopg2 Installation
Encountering the "pg_config executable not found" error when installing psycopg2 via pip can be perplexing, even when pg_config seems to be present in your PATH. This issue arises due to the psycopg2 package relying on the header files provided by the postgresql-devel package (libpq-dev for Debian/Ubuntu or libpq-devel for Centos/Fedora/Cygwin/Babun).
To resolve this issue, install the postgresql-devel package using your system's package manager. For example, on Fedora or CentOS, you would run:
sudo yum install postgresql-devel
Once the package is installed, psycopg2 should recognize the pg_config executable and complete the installation without encountering the aforementioned error.
The above is the detailed content of Why Can't Psycopg2 Find pg_config Even Though It's in My PATH?. For more information, please follow other related articles on the PHP Chinese website!