pg_config executable not found

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

    You should add python requirements used in Postgres on Ubuntu. Run:

    sudo apt-get install libpq-dev python-dev
    
    0 讨论(0)
  • Have you installed python-dev? If you already have, try also installing libpq-dev

    sudo apt-get install libpq-dev python-dev
    

    From the article: How to install psycopg2 under virtualenv

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

    I recommend that you try to use Postgres.app. (http://postgresapp.com) This way you can easily turn Postgres on and off on your Mac. Once you do, add the path to Postgres to your .profile file by appending the following:

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

    Only after you added Postgres to your path you can try to install psycopg2 either within a virtual environment (using pip) or into your global site-packages.

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

    pg_config is in postgresql-devel (libpq-dev in Debian/Ubuntu, libpq-devel on Centos/Cygwin/Babun.)

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

    For mac users, extend your path variable to include PostgreSQL like this export PATH=$PATH:/Library/PostgreSQL/12/bin.

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

    For those running OS X, this solution worked for me:

    1) Install Postgres.app:

    http://www.postgresql.org/download/macosx/

    2) Then open the Terminal and run this command, replacing where it says {{version}} with the Postgres version number:

    export PATH=$PATH:/Applications/Postgres.app/Contents/Versions/{{version}}/bin

    e.g.

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

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