I’m not exactly sure what causes this, but some combination of Homebrew, pyenv, and macOS causes pip install psycopg2
to fail consistently. The error is usually something like:
ld: library not found for -lssl
It seems like most people can fix this by install Xcode and running xcode-select --install
, but not I!
There’s a magic environment variable you can set that fixes it, but I always forget how to find it with Google so I’m posting it here for posterity.
export LDFLAGS="-L/usr/local/opt/openssl/lib" export CPPFLAGS="-I/usr/local/opt/openssl/include"