Python pip install 명령어 옵션에 대해 알아보도록 하겠습니다. 우선 파이썬을 사용하는 개발자라면 누구나 안전하고 효율적인 개발 환경을 구축하기를 원합니다.
참고 : 파이썬 다운로드 및 설치 – 윈도우 / Mac OS X
또한 최근 발견된 파이썬 저장소의 악성 코드 문제와 Visual Studio Code를 활용한 효과적인 파이썬 환경 설정 방법, 그리고 파이썬 애플리케이션을 EXE 파일로 변환하는 과정까지, 파이썬 개발의 A부터 Z까지 자세히 안내하겠습니다. pip를 사용한 다양한 패키지 설치 옵션들을 통해 더욱 심도 있는 파이썬 활용법을 알아보도록 하겠습니다.
사용법:
pip install [options] <requirement specifier> [package-index-options] ...
pip install [옵션] -r <요구 사항 파일> [패키지 인덱스 옵션] ...
pip install [옵션] [-e] <vcs 프로젝트 URL> ...
pip install [옵션] [-e] <로컬 프로젝트 경로> ...
pip install [옵션] <아카이브 URL / 경로> ...
기술:
다음에서 패키지 설치 :
-요구 사항 지정자를 사용하는 PyPI (및 기타 인덱스).
-VCS 프로젝트 URL.
-로컬 프로젝트 디렉토리.
-로컬 또는 원격 소스 아카이브.
pip는 또한 "요구 사항 파일"에서 설치를 지원합니다.
설치할 전체 환경을 쉽게 지정할 수 있습니다.
설치 옵션 :
-c, --constraint <파일> 주어진 제약 조건을 사용하여 버전 제한
파일. 이 옵션은 여러 번 사용할 수 있습니다.
-e, --editable <path / url> 편집 가능한 모드로 프로젝트를 설치합니다 (예 :
로컬 프로젝트의 setuptools "개발 모드")
경로 또는 VCS URL.
-r, --requirement <파일> 주어진 요구 사항 파일에서 설치합니다. 이
옵션은 여러 번 사용할 수 있습니다.
-b, --build <dir> 패키지를 풀고 빌드 할 디렉토리입니다.
-t, --target <dir> 패키지를 <dir>에 설치합니다. 기본적으로
기존 파일 / 폴더를 대체하지 않습니다.
<dir>. --upgrade를 사용하여 기존
새 버전으로 <dir>의 패키지.
-d, --download <dir> 대신 <dir>에 패키지 다운로드
이미 무엇이든 상관없이 설치
설치되었습니다.
--src <dir> 편집 가능한 프로젝트를 체크 아웃 할 디렉토리입니다.
virtualenv의 기본값은 "<venv입니다.
path> / src ". 전역 설치의 기본값은 다음과 같습니다.
"<현재 디렉토리> / src".
-U, --upgrade 지정된 모든 패키지를 최신으로 업그레이드
사용 가능한 버전. 종속성 처리
사용 된 업그레이드 전략에 따라 다릅니다.
--upgrade-strategy <업그레이드 _ 전략>
종속성 업그레이드 방법을 결정합니다.
취급. "eager"-종속성이 업그레이드됩니다.
현재 설치 여부에 관계없이
버전은 요구 사항을 충족합니다
업그레이드 된 패키지. "필요한 경우에만"-
그들이 만족하지 않을 때만 업그레이드
업그레이드 된 패키지의 요구 사항.
--force-reinstall 업그레이드 할 때
이미 최신 상태입니다.
-I, --ignore-installed 설치된 패키지 무시 (재설치
대신).
--ignore-requires-python requires-Python 정보를 무시합니다.
--no-deps 패키지 종속성을 설치하지 마십시오.
--install-option <options> setup.py에 제공 할 추가 인수
설치 명령 (--install-option = "-과 같이 사용)
install-scripts = / usr / local / bin "). 여러
-설치 옵션 옵션을 여러 개 전달
setup.py 설치 옵션. 사용하는 경우
디렉토리 경로가있는 옵션을 사용하려면
절대 경로.
--global-option <options>에 제공 할 추가 전역 옵션
설치 명령 전에 setup.py 호출.
--user Python 사용자 설치 디렉토리에 설치
귀하의 플랫폼. 일반적으로 ~ / .local / 또는
Windows의 % APPDATA % \ Python. (Python
site.USER_BASE에 대한 설명서 전체
세부.)
--egg pip와 같이 '플랫'이 아닌 달걀로 패키지를 설치합니다.
일반적으로 그렇습니다. 이 옵션은
*에서 * 계란 설치. (경고 :이 때문에
옵션은 pip의 일반 설치 로직을 재정의합니다.
요구 사항 파일이 예상대로 작동하지 않을 수 있습니다.)
--root <dir>이 대안과 관련된 모든 것을 설치합니다.
루트 디렉토리.
--prefix <dir> lib, bin 및 기타 설치 접두사
최상위 폴더가 배치됩니다.
--compile py 파일을 pyc로 컴파일
--no-compile py 파일을 pyc로 컴파일하지 마십시오.
--no-use-wheel 휠 아카이브를 찾고 선호하지 않는 경우
색인 검색 및 링크 위치 찾기.
--no-binary에 찬성하여 지원 중단되었습니다.
--no-binary <포맷 _ 컨트롤>
바이너리 꾸러미를 사용하지 마십시오. 공급 가능
여러 번, 매번
기존 가치. 비활성화하려면 : all : 중 하나를 허용합니다.
모든 바이너리 패키지, : none : 세트를 비우거나
사이에 쉼표가있는 하나 이상의 패키지 이름
그들. 일부 패키지는 까다로운
이 옵션을 사용하면 컴파일하고 설치하지 못할 수 있습니다.
그들에게 사용됩니다.
--only-binary <포맷 _ 컨트롤>
소스 패키지를 사용하지 마십시오. 공급 가능
여러 번, 매번
기존 가치. 비활성화하려면 : all : 중 하나를 허용합니다.
모든 소스 패키지, : none : 세트 비우기 또는
사이에 쉼표가있는 하나 이상의 패키지 이름
그들. 바이너리 배포판이없는 패키지는
이 옵션을 사용할 때 설치 실패
그들.
--pre 시험판 및 개발 버전을 포함합니다. 으로
기본적으로 pip는 안정적인 버전 만 찾습니다.
--no-clean 빌드 디렉토리를 정리하지 마십시오.
--require-hashes 각 요구 사항을 확인하려면 해시가 필요합니다.
반복 가능한 설치를 위해. 이 옵션은
요구 사항 파일의 패키지가
--hash 옵션이 있습니다.
패키지 색인 옵션 (사용되지 않는 옵션 포함) :
-i, --index-url <url> Python 패키지 색인의 기본 URL (기본값
https://pypi.python.org/simple). 이것은
PEP 503을 준수하는 저장소를 가리 킵니다.
(간단한 저장소 API) 또는 로컬 디렉토리
동일한 형식으로 배치됩니다.
--extra-index-url <url> 추가로 사용할 패키지 색인의 추가 URL
--index-url. 다음과 같은 규칙을 따라야합니다.
--index-url.
--no-index 패키지 인덱스 무시 (--find-
대신 URL 링크).
-f, --find-links <url> URL 또는 html 파일의 경로 인 경우
아카이브 링크. 로컬 경로 또는 file : //
디렉토리 URL을 입력 한 다음 아카이브를 찾습니다.
디렉토리 목록에서.
--process-dependency-links 종속성 링크 처리를 활성화합니다.
일반 옵션:
-h, --help 도움말을 표시합니다.
--isolated 격리 모드에서 pip 실행, 무시
환경 변수 및 사용자 구성.
-v, --verbose 더 많은 출력을 제공합니다. 옵션은 부가 적이며
최대 3 회 사용.
-V, --version 버전을 표시하고 종료합니다.
-q, --quiet 더 적은 출력을 제공합니다. 옵션은 부가 적이며
최대 3 회 사용 (WARNING,
ERROR 및 CRITICAL 로깅 수준).
--log <path> 자세한 추가 로그의 경로입니다.
--proxy <proxy> 형식으로 프록시 지정
[user : passwd @] proxy.server : port.
--retries <재시도> 각 연결이 수행해야하는 최대 재시도 횟수
시도 (기본값 5 회).
--timeout <sec> 소켓 시간 제한 (기본값 15 초)을 설정합니다.
--exists-action <action> 경로가 이미 존재할 때 기본 동작 :
(s) witch, (i) gnore, (w) ipe, (b) ackup, (a) bort.
--trusted-host <hostname> 신뢰할 수있는 호스트로 표시합니다.
유효하지 않거나 HTTPS가 없습니다.
--cert <path> 대체 CA 번들의 경로입니다.
--client-cert <path> 단일 파일 인 SSL 클라이언트 인증서 경로
개인 키 및 인증서 포함
PEM 형식으로.
--cache-dir <dir> 캐시 데이터를 <dir>에 저장합니다.
--no-cache-dir 캐시를 비활성화합니다.
--disable-pip-version-check
PyPI를 주기적으로 확인하여 결정하지 마십시오.
pip의 새 버전을 사용할 수 있는지 여부
다운로드. --no-index와 함축됩니다.
Usage:
pip install [options] <requirement specifier> [package-index-options] ...
pip install [options] -r <requirements file> [package-index-options] ...
pip install [options] [-e] <vcs project url> ...
pip install [options] [-e] <local project path> ...
pip install [options] <archive url/path> ...
Description:
Install packages from:
- PyPI (and other indexes) using requirement specifiers.
- VCS project urls.
- Local project directories.
- Local or remote source archives.
pip also supports installing from "requirements files", which provide
an easy way to specify a whole environment to be installed.
Install Options:
-c, --constraint <file> Constrain versions using the given constraints
file. This option can be used multiple times.
-e, --editable <path/url> Install a project in editable mode (i.e.
setuptools "develop mode") from a local project
path or a VCS url.
-r, --requirement <file> Install from the given requirements file. This
option can be used multiple times.
-b, --build <dir> Directory to unpack packages into and build in.
-t, --target <dir> Install packages into <dir>. By default this
will not replace existing files/folders in
<dir>. Use --upgrade to replace existing
packages in <dir> with new versions.
-d, --download <dir> Download packages into <dir> instead of
installing them, regardless of what's already
installed.
--src <dir> Directory to check out editable projects into.
The default in a virtualenv is "<venv
path>/src". The default for global installs is
"<current dir>/src".
-U, --upgrade Upgrade all specified packages to the newest
available version. The handling of dependencies
depends on the upgrade-strategy used.
--upgrade-strategy <upgrade_strategy>
Determines how dependency upgrading should be
handled. "eager" - dependencies are upgraded
regardless of whether the currently installed
version satisfies the requirements of the
upgraded package(s). "only-if-needed" - are
upgraded only when they do not satisfy the
requirements of the upgraded package(s).
--force-reinstall When upgrading, reinstall all packages even if
they are already up-to-date.
-I, --ignore-installed Ignore the installed packages (reinstalling
instead).
--ignore-requires-python Ignore the Requires-Python information.
--no-deps Don't install package dependencies.
--install-option <options> Extra arguments to be supplied to the setup.py
install command (use like --install-option="--
install-scripts=/usr/local/bin"). Use multiple
--install-option options to pass multiple
options to setup.py install. If you are using an
option with a directory path, be sure to use
absolute path.
--global-option <options> Extra global options to be supplied to the
setup.py call before the install command.
--user Install to the Python user install directory for
your platform. Typically ~/.local/, or
%APPDATA%\Python on Windows. (See the Python
documentation for site.USER_BASE for full
details.)
--egg Install packages as eggs, not 'flat', like pip
normally does. This option is not about
installing *from* eggs. (WARNING: Because this
option overrides pip's normal install logic,
requirements files may not behave as expected.)
--root <dir> Install everything relative to this alternate
root directory.
--prefix <dir> Installation prefix where lib, bin and other
top-level folders are placed
--compile Compile py files to pyc
--no-compile Do not compile py files to pyc
--no-use-wheel Do not Find and prefer wheel archives when
searching indexes and find-links locations.
DEPRECATED in favour of --no-binary.
--no-binary <format_control>
Do not use binary packages. Can be supplied
multiple times, and each time adds to the
existing value. Accepts either :all: to disable
all binary packages, :none: to empty the set, or
one or more package names with commas between
them. Note that some packages are tricky to
compile and may fail to install when this option
is used on them.
--only-binary <format_control>
Do not use source packages. Can be supplied
multiple times, and each time adds to the
existing value. Accepts either :all: to disable
all source packages, :none: to empty the set, or
one or more package names with commas between
them. Packages without binary distributions will
fail to install when this option is used on
them.
--pre Include pre-release and development versions. By
default, pip only finds stable versions.
--no-clean Don't clean up build directories.
--require-hashes Require a hash to check each requirement
against, for repeatable installs. This option is
implied when any package in a requirements file
has a --hash option.
Package Index Options (including deprecated options):
-i, --index-url <url> Base URL of Python Package Index (default
https://pypi.python.org/simple). This should
point to a repository compliant with PEP 503
(the simple repository API) or a local directory
laid out in the same format.
--extra-index-url <url> Extra URLs of package indexes to use in addition
to --index-url. Should follow the same rules as
--index-url.
--no-index Ignore package index (only looking at --find-
links URLs instead).
-f, --find-links <url> If a url or path to an html file, then parse for
links to archives. If a local path or file://
url that's a directory, then look for archives
in the directory listing.
--process-dependency-links Enable the processing of dependency links.
General Options:
-h, --help Show help.
--isolated Run pip in an isolated mode, ignoring
environment variables and user configuration.
-v, --verbose Give more output. Option is additive, and can be
used up to 3 times.
-V, --version Show version and exit.
-q, --quiet Give less output. Option is additive, and can be
used up to 3 times (corresponding to WARNING,
ERROR, and CRITICAL logging levels).
--log <path> Path to a verbose appending log.
--proxy <proxy> Specify a proxy in the form
[user:passwd@]proxy.server:port.
--retries <retries> Maximum number of retries each connection should
attempt (default 5 times).
--timeout <sec> Set the socket timeout (default 15 seconds).
--exists-action <action> Default action when a path already exists:
(s)witch, (i)gnore, (w)ipe, (b)ackup, (a)bort.
--trusted-host <hostname> Mark this host as trusted, even though it does
not have valid or any HTTPS.
--cert <path> Path to alternate CA bundle.
--client-cert <path> Path to SSL client certificate, a single file
containing the private key and the certificate
in PEM format.
--cache-dir <dir> Store the cache data in <dir>.
--no-cache-dir Disable the cache.
--disable-pip-version-check
Don't periodically check PyPI to determine
whether a new version of pip is available for
download. Implied with --no-index.
이상 오늘 소개한 내용을 통해 여러분의 파이썬 개발 환경이 한층 더 강화되기를 바랍니다.
악성 코드로부터 자신의 프로젝트를 보호하는 방법, 효과적인 개발 환경을 구축하는 방법, 그리고 EXE 파일 생성까지, 이 모든 과정이 파이썬 개발자들에게 실질적인 도움이 되었기를 희망합니다. 앞으로도 안전하고 효율적인 개발을 위해 지속적으로 새로운 정보를 제공해 드리도록 하겠습니다. 다음 포스팅에서 만나요!