install Psycopg2 on mac osx 10.9.5

后端 未结 12 623
清酒与你
清酒与你 2020-11-27 04:42

I\'m trying to install Psycopg2 on my Mac-book. I still get the same error. I found a lot of same questions on Stack Overflow but no answer seems to work. I think it is outd

相关标签:
12条回答
  • 2020-11-27 05:28

    $ find / -name pg_config 2>/dev/null

    /Applications/Postgres.app/Contents/Versions/9.3/bin/pg_config

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

    $ pip install psycopg2

    0 讨论(0)
  • 2020-11-27 05:33

    My issue was that for some reason from within VENV pip install psycopg2 does not work but I found that running this command from inside of VENV

    env LDFLAGS='-L/usr/local/lib -L/usr/local/opt/openssl/lib -L/usr/local/opt/readline/lib' pip install psycopg2
    

    allow me to install it on mac.

    0 讨论(0)
  • 2020-11-27 05:34

    If you use Docker and you do not want to install postgresql in you host system, you can try to use package psycopg2-binary and use postgresql in container.

    0 讨论(0)
  • 2020-11-27 05:35

    To install psycopg2 you need have installed server before( I have installed PostgresApp)

    Run manually command including the path of pg_config program in PATH env variable, in my case:

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

    and then run

    pip3 install psycopg2
    

    EDIT:

    Check directory of pg_config:

    which pg_config
    
    0 讨论(0)
  • 2020-11-27 05:38

    On my MAC, this did the trick:

    pip install psycopg2-binary
    
    0 讨论(0)
  • 2020-11-27 05:42

    I was fighting with this issue for a complete day. Then I ran a script that I found in Pillow library Issues and solve the problem. Check it out https://github.com/python-pillow/Pillow/issues/3438#issuecomment-435169249

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