ensurepip — 自引导 pip 安装程序

Added in version 3.4.

源代码: Lib/ensurepip


The ensurepip package provides support for bootstrapping the pip installer into an existing Python installation or virtual environment. This bootstrapping approach reflects the fact that pip is an independent project with its own release cycle, and the latest available stable version is bundled with maintenance and feature releases of the CPython reference interpreter.

In most cases, end users of Python shouldn’t need to invoke this module directly (as pip should be bootstrapped by default), but it may be needed if installing pip was skipped when installing Python (or when creating a virtual environment) or after explicitly uninstalling pip .

注意

This module does not access the internet. All of the components needed to bootstrap pip are included as internal parts of the package.

另请参阅

安装 Python 模块

The end user guide for installing Python packages

PEP 453 : Explicit bootstrapping of pip in Python installations

The original rationale and specification for this module.

可用性 : not Android, not iOS, not WASI.

This module is not supported on mobile platforms or WebAssembly 平台 .

Command line interface

The command line interface is invoked using the interpreter’s -m switch.

The simplest possible invocation is:

python -m ensurepip