Installing psycopg2 fails on MacOS with unclear error message

后端 未结 3 1780
花落未央
花落未央 2021-02-01 08:04

Trying to install psycopg2 using pip 19.1 on MacOS 10.14.4 returns the lengthy error message below. I understand there are warnings related to gcc, but given the actual error me

3条回答
  •  攒了一身酷
    2021-02-01 08:46

    I had this problem running pip install psycopg2 while I was running OSX 10.14.4. I fixed it by:

    1. Running pg_config and noticed the variable:

      CPPFLAGS = -I/usr/local/Cellar/icu4c/63.1/include -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -I/usr/local/opt/openssl/include -I/usr/local/opt/readline/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/libxml2
      

      However /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk did not exist on my machine.

      So I changed it to /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk

    2. I ran these two commands:

      export CPPFLAGS="-I/usr/local/Cellar/icu4c/63.1/include -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.sdk -I/usr/local/opt/openssl/include -I/usr/local/opt/readline/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/libxml2"
      
      pip install psycopg2
      

提交回复
热议问题