Skip to content

Pipenv

Pipenv is a dependency and virtual environment manager for Python that uses a Pipfile and Pipfile.lock to provide reproducible installs and per-project isolation.

Installation and Setup

Install from the Python Package Index (PyPI) into a virtual environment:

Language: Windows PowerShell
PS> py -m pip install pipenv
PS> pipenv --version
Language: Shell
$ python -m pip install pipenv
$ pipenv --version

On Windows, Pipenv’s documentation recommends installing with pipx instead, which puts Pipenv in an isolated environment and makes the pipenv command available system-wide:

Language: Windows PowerShell
PS> py -m pip install --user pipx
PS> pipx install pipenv

Key Features

  • Manages a per-project environment and dependencies with a CLI.
  • Uses Pipfile for declared dependencies and Pipfile.lock for fully pinned, repeatable installs.
  • Supports the PEP 751 pylock.toml standard lockfile format, generated alongside Pipfile.lock when use_pylock = true is set in the Pipfile.
  • Supports arbitrary package categories beyond the default and development groups, selectable with --categories, plus export to requirements.txt format.
  • Provides useful commands for security checks, dependency graphs, and environment inspection.
  • Loads .env files for pipenv run and pipenv shell to supply environment variables during commands.

Usage

Create a virtual environment and specify the Python to use:

Language: Shell
$ pipenv --python 3.14

A minimal Pipfile file:

Language: TOML Filename: Pipfile
[requires]
python_version = "3.14"

[packages]
requests = "~=2.32"

[dev-packages]
pytest = "~=8.0"

[scripts]
test = "pytest -q"

Install packages and update the lockfile:

Language: Shell
$ pipenv install django
$ pipenv install --dev ruff pytest
$ pipenv lock

Enter the virtual environment or run a command inside it:

Language: Shell
$ pipenv shell
$ pipenv run pytest

Recreate the environment from the lockfile on a different machine:

Language: Shell
$ pipenv sync
$ pipenv sync --dev

Export pinned dependencies:

Language: Shell
$ pipenv requirements > requirements.txt
$ pipenv requirements --dev > requirements-dev.txt
A Guide to Pipenv, the new Python Packaging Tool

Tutorial

Pipenv: A Guide to the Python Packaging Tool

Pipenv replaces pip, virtualenv, and requirements.txt with a single tool. See what it solves and how to manage dependencies with it.

intermediate tools

For additional information on related topics, take a look at the following resources:

Have a question about this? Mentor AI can show you examples, compare related terms, and point you to tutorials.


By Leodanis Pozo Ramos • Updated Sept. 12, 2026