pip install
패키지·런타임
쓰는 꼴
python -m pip install [-r requirements.txt] <package>지금 활성인 파이썬에 패키지를 넣습니다 — pip이 다른 인터프리터의 것일 수 있어 python -m pip으로 부르는 편이 안전하고, PEP 668 이후 시스템 파이썬은 가상환경 밖 설치를 거부합니다.
자주 쓰는 옵션
| 옵션 | 뜻 |
|---|---|
| -r <file> | install everything a requirements file lists |
| -U | upgrade to the newest allowed version |
| -e . | editable install of the project you are in |
| --user | into your home directory instead of the system |
| --no-deps | this package only, no dependencies |
| -c <file> | apply a constraints file to the versions |
| --break-system-packages | override the PEP 668 refusal on a system python |
예시
python -m pip install -r requirements.txtinstalls a pinned set into the active environment
python -m pip install -U requestsupgrades one package
python -m pip install -e .installs your own project so edits take effect at once
무엇을 어디에 넣는지가 문제입니다. 프로젝트 안인지 시스템 전체인지 먼저 정하세요.
읽는 방법
- 대괄호 [ ]는 넣어도 되고 안 넣어도 되는 자리입니다.
- 점 셋 …은 여러 개를 이어 쓸 수 있다는 뜻입니다.
- 옵션은 대소문자를 가립니다 — -r과 -R이 다른 명령도 있습니다.
자주 묻는 것
Q. pip install은 무엇을 하나요?
지금 활성인 파이썬에 패키지를 넣습니다 — pip이 다른 인터프리터의 것일 수 있어 python -m pip으로 부르는 편이 안전하고, PEP 668 이후 시스템 파이썬은 가상환경 밖 설치를 거부합니다.
Q. 어떻게 치나요?
python -m pip install [-r requirements.txt] <package> — 대괄호는 생략할 수 있는 자리입니다.
Q. 옵션은 몇 개나 자주 쓰나요?
여기 정리한 것은 7개입니다. 전체 목록은 man pip에 있습니다. 이 명령은 패키지·런타임 갈래입니다.
같이 보는 명령
man 페이지: man pip-install