Python ensurepip: bootstrap pip into an existing install
Answer: The ensurepip package bootstraps the pip installer into an existing Python installation or virtual environment.
What it does
It was added in version 3.4.
Pip is an independent project with its own release cycle, so CPython bundles a stable copy and bootstraps it this way.
End users usually do not need to run the module, because pip should already be bootstrapped by default.
A direct run may still be needed if the installer was skipped, or after pip was explicitly uninstalled.
This module does not access the internet. The components needed to bootstrap pip are included as internal parts of the package.
How to run it
The command line interface is invoked with the interpreter's -m switch.
Running python -m ensurepip installs pip when it is missing, and otherwise does nothing.
By default, pipX and pipX.Y scripts are installed. X.Y stands for the version of Python used to invoke ensurepip.
A --default-pip request also installs a pip script beside those two.
An --altinstall request skips the pipX script. Providing both of the script selection options will trigger an exception.
The version function returns a string for the pip release that will be installed during a bootstrap.
See also
Claims
- id: C1 claim: It was added in version 3.4. source: S1 evidence: "Added in version 3.4."
- id: C2 claim: The module does not access the internet. source: S1 evidence: "This module does not access the internet."
- id: C3 claim: The RST source also records that the module was added in 3.4. source: S2 evidence: "versionadded:: 3.4"
Sources
- [S1] ensurepip — Bootstrapping the pip installer. Python Software Foundation. https://docs.python.org/3/library/ensurepip.html . License: PSF License Version 2. Accessed 2026-11-26.
- [S2] ensurepip documentation (source). CPython. https://raw.githubusercontent.com/python/cpython/main/Doc/library/ensurepip.rst . License: PSF License Version 2. Accessed 2026-11-26.
License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: Python Software Foundation, ensurepip — Bootstrapping the pip installer; CPython, ensurepip documentation (source). PSF-2.0 (https://docs.python.org/3/license.html). Copyright Python Software Foundation. Text was condensed and changed from the originals.
License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: Python Software Foundation, ensurepip — Bootstrapping the pip installer; CPython, ensurepip documentation (source). PSF-2.0 (https://docs.python.org/3/license.html). Copyright Python Software Foundation.
Cite this
iinventedlight. 2026. "Python ensurepip: bootstrap pip into an existing install." iinventedlight Library, iil:note:ccjrafax, version of 2026-11-26. https://iinventedlight.com/library/notes/python-ensurepip/. License: CC-BY-4.0.
@misc{iil_note_ccjrafax,
author = {{iinventedlight}},
title = {{Python ensurepip: bootstrap pip into an existing install}},
howpublished = {iinventedlight Library},
year = {2026},
date = {2026-11-26},
url = {https://iinventedlight.com/library/notes/python-ensurepip/},
note = {Permanent ID iil:note:ccjrafax. License: CC-BY-4.0.},
}
Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).
Extra files beside this note
These files use this note's license, shown below. Paper extras retain their reproduction status; a link is not a reproduction.
- python-ensurepip.schema.json (schema; CC-BY-4.0)
- python-ensurepip.table.json (table; CC-BY-4.0)
For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/python-ensurepip.md.