pip install psycopg2-binary

2025. 3. 13. 21:05Python, Django/Django

원래 사용하던 블로그 - https://yeonnan.hashnode.dev/pip-install-psycopg2-binary?source=more_series_bottom_blogs

 

pip install psycopg2-binary

데이터를 자동으로 생성해주는 django seed 설치 과정에서 오류 발생 1. instsll pip install django-seed 2. settings.py에 추가 3. seeding ⁠python manage.py seed articles --number=30 4. ⁠ModuleNotFoundError: No module named 'psycopg

yeonnan.hashnode.dev

 

 

데이터를 자동으로 생성해주는 django seed 설치 과정에서 오류 발생

1. instsll pip install django-seed

2. settings.py에 추가

3. seeding ⁠python manage.py seed articles --number=30

4. ⁠ModuleNotFoundError: No module named 'psycopg2'⁠ 발생

5. pip install psycopg2 설치

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

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

에러로 설치 실패

6. pip install psycopg2-binary

잘 설치되었다.

7. 다시 sedding python manage.py seed articles --number=30을 해주면
데이터가 잘 생성되었다.


psycopg2-binary는 psycopg2 라이브러리의 바이너리 버전을 의미한다.

psycopg2-binary는 미리 컴파일된 바이너리 패키지로 제공되기 때문에 사용자가 별도의 컴파일 과정 없이 쉽게 설치할 수 있다.

하지만, 공식 문서에서는 개발 환경에서의 편의를 위해 psycopg2-binary 사용을 권장하되,

프로덕션 환경에서는 C 라이브러리에 대한 컴파일 과정을 거쳐 psycopg2를 직접 설치할 것을 권장한다.

이는 psycopg2-binary가 특정 환경에서는 예상치 못한 문제를 일으킬 수 있기 때문이다.

'Python, Django > Django' 카테고리의 다른 글

Django HTTP  (0) 2025.03.13
RESTful API  (0) 2025.03.13
Django many to many relationships  (0) 2025.03.13
else 문의 위치를 잘 확인하자  (0) 2025.03.13
Django 장고 Form, Django model, ORM, MTV  (0) 2025.03.13