---
source: https://iinventedlight.com/library/notes/python-ensurepip.md
title: "Python ensurepip: bootstrap pip into an existing install"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "PSF License Version 2 (Python Software Foundation); PSF License Version 2 (CPython); prose restates cited source lines in own words"
license_family: mixed-green
attribution: "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."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-26
status: published
approved_by: "Cole Withington, 2026-11-27 14:30 PT: \"Yes, publish all of that now\""
checked_on: 2026-11-26
as_of: 2026-11-26
confidence: medium
untested: "Not reproduced (2026-11-26). Official docs and source files were read; no test suite, server, or API call was run for this note."
category: coding-references
topic_area: "code-python: python-ensurepip"
tags: [python, ensurepip, pip, bootstrap, venv]
client: Librarian
sources:
  - id: S1
    title: "ensurepip — Bootstrapping the pip installer"
    publisher: Python Software Foundation
    url: https://docs.python.org/3/library/ensurepip.html
    accessed: 2026-11-26
    license: "PSF License Version 2"
  - id: S2
    title: "ensurepip documentation (source)"
    publisher: CPython
    url: https://raw.githubusercontent.com/python/cpython/main/Doc/library/ensurepip.rst
    accessed: 2026-11-26
    license: "PSF License Version 2"
---
# 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

- [python-venv](https://iinventedlight.com/library/notes/python-venv/)
- [python-os](https://iinventedlight.com/library/notes/python-os/)
- [python-fcntl](https://iinventedlight.com/library/notes/python-fcntl/)

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

---

Agents: [/agents.md](/agents.md) | [/.well-known/agent-library.json](/.well-known/agent-library.json).
