Can't install psycopg2 package through pip install… Is this because of Sierra?

后端 未结 13 878
逝去的感伤
逝去的感伤 2020-11-28 01:35

I am working on a project for one of my lectures and I need to download the package psycopg2 in order to work with the postgresql database in use. Unfortunately, when I try

相关标签:
13条回答
  • 2020-11-28 02:13
    env LDFLAGS="-I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib" \
    brew upgrade openssl
    

    Then I could install psycopg2

    0 讨论(0)
  • 2020-11-28 02:15

    I fixed it with:

    brew reinstall openssl
    
    export LIBRARY_PATH=$LIBRARY_PATH:/usr/local/opt/openssl/lib/
    
    0 讨论(0)
  • 2020-11-28 02:17

    This works for me (on a terminal):

    find / -name pg_config  2>/dev/null
    

    then add the path:

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

    os version: MacOs Sierra

    I hope this helps.

    0 讨论(0)
  • 2020-11-28 02:17

    It looks like the openssl package is not installed. Try installing it and pip install again. I'm not a macos user, but I believe that brew simplifies package management on that platform.

    You might also need to install the Python development and postgresql development packages.

    0 讨论(0)
  • 2020-11-28 02:19

    I fixed this by installing Command Line Tools

    xcode-select --install
    

    then installing openssl via Homebrew and manually linking my homebrew-installed openssl to pip:

    env LDFLAGS="-I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib" pip install psycopg2
    

    on macOS Sierra 10.12.1

    0 讨论(0)
  • 2020-11-28 02:24

    Try installing it with:

    pip install psycopg2-binary
    
    0 讨论(0)
提交回复
热议问题