pg_config executable not found

后端 未结 30 2147
渐次进展
渐次进展 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:29

    I'm going to leave this here for the next unfortunate soul who can't get around this problem despite all the provided solutions. Simply use sudo pip3 install psycopg2-binary

    0 讨论(0)
  • 2020-11-22 16:31

    Just solved the problem in Cent OS 7 by:

    export PATH=$PATH:/usr/pgsql-9.5/bin
    

    make sure your PostgreSql version matches the right version above.

    0 讨论(0)
  • 2020-11-22 16:31

    sudo yum install postgresql-devel (centos6X)

    pip install psycopg2==2.5.2

    0 讨论(0)
  • 2020-11-22 16:33

    On alpine, the library containing pg_config is postgresql-dev. To install, run:

    apk add postgresql-dev
    
    0 讨论(0)
  • 2020-11-22 16:33

    Ali's solution worked for me but I was having trouble finding the bin folder location. A quick way to find the path on Mac OS X is to open psql (there's a quick link in the top menu bar). This will open a separate terminal window and on the second line the path of your Postgres installation will appear like so:

    My-MacBook-Pro:~ Me$ /Applications/Postgres93.app/Contents/MacOS/bin/psql ; exit;
    

    Your pg_config file is in that bin folder. Therefore, before installing psycopg2 set the path of the pg_config file:

    PATH=$PATH:/Applications/Postgres93.app/Contents/MacOS/bin/
    

    or for newer version:

    PATH=$PATH:/Applications/Postgres.app/Contents/Versions/9.3/bin
    

    Then install psycopg2.

    0 讨论(0)
  • 2020-11-22 16:33

    On Windows, You may want to install the Windows port of Psycopg, which is recommended in psycopg's documentation.

    0 讨论(0)
提交回复
热议问题