pg_config executable not found

后端 未结 30 2393
渐次进展
渐次进展 2020-11-22 15:42

I am having trouble installing psycopg2. I get the following error when I try to pip install psycopg2:

Error: pg_config executable not found.

P         


        
30条回答
  •  孤独总比滥情好
    2020-11-22 16:10

    Just to sum up, I also faced exactly same problem. After reading a lot of stackoverflow posts and online blogs, the final solution which worked for me is this:

    1) PostgreSQL(development or any stable version) should be installed before installing psycopg2.

    2) The pg_config file (this file normally resides in the bin folder of the PostgreSQL installation folder) PATH had to be explicitly setup before installing psycopg2. In my case, the installation PATH for PostgreSQL is:

    /opt/local/lib/postgresql91/
    

    so in order to explicitly set the PATH of pg_config file, I entered following command in my terminal:

    PATH=$PATH:/opt/local/lib/postgresql91/bin/
    

    This command ensures that when you try to pip install psycopg2, it would find the PATH to pg_config automatically this time.

    I have also posted a full error with trace and its solution on my blog which you may want to refer. Its for Mac OS X but the pg_config PATH problem is generic and applicable to Linux also.

提交回复
热议问题