There are a few problems asked about installing psycopg2 on OSX.
Like:
After sorting out pg_conf still stuck with library not found for -lssl
On:
- OSX
- M1 Mac
- Python 3.9
CodePudding user response:
After finding this solution, was able to make it work without needing the whole of postgres installed, by using brew.
Sadly zlib or openssl are not explained in the install requirements for psycopg2
Verified with:
- OSX: Monterey 12.4
- Python: 3.9.13
- pip: 22.1.2
- psycopg2: 2.8.5
Steps:
Install libpq:
brew install libpqAdd to path, so pg_conf is found, eg:
export PATH=/opt/homebrew/opt/libpq/bin:$PATHInstall openssl:
brew install opensslAdd to library paths, eg:
export LDFLAGS="-L/opt/homebrew/opt/openssl@3/lib" export CPPFLAGS="-I/opt/homebrew/opt/openssl@3/include"pip install psycopg2==2.8.5
