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:

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

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 separate default and development dependency groups and 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:

Shell
$ pipenv --python 3.14

A minimal Pipfile file:

TOML 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:

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

Enter the virtual environment or run a command inside it:

Shell
$ pipenv shell
$ pipenv run pytest

Recreate the environment from the lockfile on a different machine:

Shell
$ pipenv sync
$ pipenv sync --dev

Export pinned dependencies:

Shell
$ pipenv lock -r > requirements.txt
$ pipenv lock -r --dev > requirements-dev.txt

Tutorial

Pipenv: A Guide to the Python Packaging Tool

Pipenv is a packaging tool for Python that solves some common problems associated with the typical workflow using pip, virtualenv, and the good old requirements.txt. This guide goes over what problems Pipenv solves and how to manage your Python dependencies with it.

intermediate tools

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


By Leodanis Pozo Ramos • Updated Dec. 1, 2025