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:
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:
PS> py -m pip install --user pipx
PS> pipx install pipenv
Key Features
- Manages a per-project environment and dependencies with a CLI.
- Uses
Pipfilefor declared dependencies andPipfile.lockfor fully pinned, repeatable installs. - Supports the PEP 751
pylock.tomlstandard lockfile format, generated alongsidePipfile.lockwhenuse_pylock = trueis set in thePipfile. - Supports arbitrary package categories beyond the default and development groups, selectable with
--categories, plus export torequirements.txtformat. - Provides useful commands for security checks, dependency graphs, and environment inspection.
- Loads
.envfiles forpipenv runandpipenv shellto supply environment variables during commands.
Usage
Create a virtual environment and specify the Python to use:
$ pipenv --python 3.14
A minimal Pipfile file:
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:
$ pipenv install django
$ pipenv install --dev ruff pytest
$ pipenv lock
Enter the virtual environment or run a command inside it:
$ pipenv shell
$ pipenv run pytest
Recreate the environment from the lockfile on a different machine:
$ pipenv sync
$ pipenv sync --dev
Export pinned dependencies:
$ pipenv requirements > requirements.txt
$ pipenv requirements --dev > requirements-dev.txt
Related Resources
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.
For additional information on related topics, take a look at the following resources:
- Working With Pipenv (Course)
- Using Python's pip to Manage Your Projects' Dependencies (Tutorial)
- Dependency Management With Python Poetry (Tutorial)
- A Beginner's Guide to pip (Course)
- Using Python's pip to Manage Your Projects' Dependencies (Quiz)
- Managing Dependencies With Python Poetry (Course)
- Dependency Management With Python Poetry (Quiz)
By Leodanis Pozo Ramos • Updated Sept. 12, 2026