BackEnd King KY

TIL41 - psycopg2-binary 2.8.6 버전 설치 시 발생했던 에러 본문

FastAPI

TIL41 - psycopg2-binary 2.8.6 버전 설치 시 발생했던 에러

Django King, Lee 2023. 1. 7. 18:39
728x90

psycopg2-binary 2.8.6 버전 설치 시 발생했던 에러

어떻게 이름을 써야할 지 몰라 제목을 이렇게 쓰게 되었습니다.


문제

FastAPI 프로젝트를 위해 psycopg2-binary를 설치하는데, 2.8.6 버전으로 설치하려고 하니 에러가 발생했습니다

ld: library not found for -lssl
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command '/usr/bin/clang' failed with exit code 1
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> psycopg2-binary

해결

우선, Postgresql 설치(했다면 스킵)

brew install postgresql

파이썬 버전 확인

python --version

-> Python 3.9.4

아래 명령어 적용

export CPPFLAGS="-I/opt/homebrew/opt/openssl@1.1/include"
export LDFLAGS="-L/opt/homebrew/opt/openssl@1.1/lib -L${HOME}/.pyenv/versions/3.9.4/lib"

다시 설치

pip install psycopg2-binary==2.8.6

'FastAPI' 카테고리의 다른 글

TIL44 - SQLAlchemy에서 Django select_related 구현  (0) 2023.02.12