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:
Key Features
- Manages a per-project environment and dependencies with a CLI.
- Uses
Pipfilefor declared dependencies andPipfile.lockfor fully pinned, repeatable installs. - Supports separate default and development dependency groups and export to
requirements.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 lock -r > requirements.txt
$ pipenv lock -r --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)
By Leodanis Pozo Ramos • Updated Dec. 1, 2025