程序员文章、书籍推荐和程序员创业信息与资源分享平台

网站首页 > 技术文章 正文

python pip 命令 参数(python-pip-whl)

hfteth 2025-06-30 16:21:09 技术文章 3 ℃

usage: python [option] ... [-c cmd | -m mod | file | -] [arg] ...

Options (and corresponding environment variables):

-b : issue warnings about converting bytes/bytearray to str and comparing

bytes/bytearray with str or bytes with int. (-bb: issue errors)

-B : don't write .pyc files on import; also PYTHONDONTWRITEBYTECODE=x

-c cmd : program passed in as string (terminates option list)

-d : turn on parser debugging output (for experts only, only works on

debug builds); also PYTHONDEBUG=x

-E : ignore PYTHON* environment variables (such as PYTHONPATH)

-h : print this help message and exit (also -? or --help)

-i : inspect interactively after running script; forces a prompt even

if stdin does not appear to be a terminal; also PYTHONINSPECT=x

-I : isolate Python from the user's environment (implies -E and -s)

-m mod : run library module as a script (terminates option list)

-O : remove assert and __debug__-dependent statements; add .opt-1 before

.pyc extension; also PYTHONOPTIMIZE=x

-OO : do -O changes and also discard docstrings; add .opt-2 before

.pyc extension

-P : don't prepend a potentially unsafe path to sys.path; also

PYTHONSAFEPATH

-q : don't print version and copyright messages on interactive startup

-s : don't add user site directory to sys.path; also PYTHONNOUSERSITE=x

-S : don't imply 'import site' on initialization

-u : force the stdout and stderr streams to be unbuffered;

this option has no effect on stdin; also PYTHONUNBUFFERED=x

-v : verbose (trace import statements); also PYTHONVERBOSE=x

can be supplied multiple times to increase verbosity

-V : print the Python version number and exit (also --version)

when given twice, print more information about the build

-W arg : warning control; arg is action:message:category:module:lineno

also PYTHONWARNINGS=arg

-x : skip first line of source, allowing use of non-Unix forms of #!cmd

-X opt : set implementation-specific option

--check-hash-based-pycs always|default|never:

control how Python invalidates hash-based .pyc files

--help-env: print help about Python environment variables and exit

--help-xoptions: print help about implementation-specific -X options and exit

--help-all: print complete help information and exit

Arguments:

file : program read from script file

- : program read from stdin (default; interactive mode if a tty)

arg ...: arguments passed to program in sys.argv[1:]

Usage:

pip <command> [options]

Commands:

install Install packages.

lock Generate a lock file.

download Download packages.

uninstall Uninstall packages.

freeze Output installed packages in requirements format.

inspect Inspect the python environment.

list List installed packages.

show Show information about installed packages.

check Verify installed packages have compatible dependencies.

config Manage local and global configuration.

search Search PyPI for packages.

cache Inspect and manage pip's wheel cache.

index Inspect information available from package indexes.

wheel Build wheels from your requirements.

hash Compute hashes of package archives.

completion A helper command used for command completion.

debug Show information useful for debugging.

help Show help for commands.

General Options:

-h, --help Show help.

--debug Let unhandled exceptions propagate outside the

main subroutine, instead of logging them to

stderr.

--isolated Run pip in an isolated mode, ignoring

environment variables and user configuration.

--require-virtualenv Allow pip to only run in a virtual environment;

exit with an error otherwise.

--python <python> Run pip with the specified Python interpreter.

-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.

--no-input Disable prompting for input.

--keyring-provider <keyring_provider>

Enable the credential lookup via the keyring

library if user input is allowed. Specify which

mechanism to use [auto, disabled, import,

subprocess]. (default: auto)

--proxy <proxy> Specify a proxy in the form

scheme://[user:passwd@]proxy.server:port.

--retries <retries> Maximum attempts to establish a new HTTP

connection. (default: 5)

--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 or host:port pair as trusted,

even though it does not have valid or any HTTPS.

--cert <path> Path to PEM-encoded CA certificate bundle. If

provided, overrides the default. See 'SSL

Certificate Verification' in pip documentation

for more information.

--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.

--no-color Suppress colored output.

--use-feature <feature> Enable new functionality, that may be backward

incompatible.

--use-deprecated <feature> Enable deprecated functionality, that will be

removed in the future.

--resume-retries <resume_retries>

Maximum attempts to resume or restart an

incomplete download. (default: 0)

Tags:

最近发表
标签列表