본문 바로가기

Python

psycopg2 error

Python으로 Postgresql을 이용할 일이 생겨서 psycopg2를 설치하기위해

pip install psycopg2
하였는데 처음에 난 error는 pg_conf executable not found error가 났다.
postgresql을 지우고 다시 설치
brew uninstall postgresql
brew install postgresql

터미널에서
daniel$ export LDFLAGS="-L/usr/local/opt/openssl/lib"
12.2 는 postgresql version 설치된 버전을 넣어주시면 됩니다.

daniel$ PATH="/Applications/Postgres.app/Contents/12.2/latest/bin:$PATH" pip install psycopg2
Collecting psycopg2
  Using cached psycopg2-2.8.4.tar.gz (377 kB)
Installing collected packages: psycopg2
    Running setup.py install for psycopg2 ... done
Successfully installed psycopg2-2.8.4

설치 완료