LinuxCommandLibrary

pipenv

TLDR

Create virtual environment and install packages

$ pipenv install [requests]
copy
Install dev dependencies
$ pipenv install --dev [pytest]
copy
Install from Pipfile
$ pipenv install
copy
Activate virtual environment
$ pipenv shell
copy
Run command in virtual environment
$ pipenv run [python script.py]
copy
Generate requirements.txt
$ pipenv requirements > requirements.txt
copy
Show dependency graph
$ pipenv graph
copy
Remove virtual environment
$ pipenv --rm
copy

SYNOPSIS

pipenv command [options] [packages]

DESCRIPTION

pipenv combines pip and virtualenv into a single workflow. It manages project dependencies with Pipfile/Pipfile.lock files, similar to npm's package.json or Ruby's Bundler.
The Pipfile replaces requirements.txt with a more structured format. It separates production and development dependencies. The Pipfile.lock ensures deterministic builds by pinning exact versions and hashes.
Virtual environments are created automatically per project. The shell command activates the environment, while run executes commands within it without manual activation. Environment location is determined by the project directory.
Security features include hash verification of packages and vulnerability scanning via check command. The graph command visualizes the dependency tree, helping understand transitive dependencies.
Pipenv integrates with .env files, automatically loading environment variables. This keeps secrets separate from code while making them available during development.

PARAMETERS

install [packages]

Install packages and add to Pipfile.
uninstall packages
Remove packages from environment.
lock
Generate Pipfile.lock.
sync
Install packages from Pipfile.lock.
shell
Spawn shell in virtual environment.
run command
Run command in virtual environment.
graph
Show dependency graph.
check
Check for security vulnerabilities.
requirements
Generate requirements.txt output.
update [packages]
Update packages.
clean
Remove packages not in Pipfile.lock.
--dev, -d
Include dev dependencies.
--python VERSION
Specify Python version.
--venv
Show virtual environment path.
--rm
Remove virtual environment.
--where
Show project home.
--three / --two
Use Python 3 / Python 2.
--site-packages
Enable system site-packages.

CAVEATS

Lock resolution can be slow for complex dependencies. Not as fast as newer tools like Poetry or uv. Hash verification requires packages have published hashes. Some edge cases in dependency resolution. May conflict with system-wide pip packages.

HISTORY

pipenv was created by Kenneth Reitz (author of requests) around 2017. It aimed to bring the developer experience of npm/Bundler to Python. PyPA endorsed it as a recommended tool. While newer alternatives like Poetry have emerged, pipenv remains widely used for its simplicity and integration with pip.

SEE ALSO

pip(1), poetry(1), virtualenv(1), uv(1)

> TERMINAL_GEAR

Curated for the Linux community

nuphy Air75 V2 Portable 75% Mechanical Keyboard,Wireless Keyboard

nuphy Air75 V2 Portable 75% Mechanical Keyboard,Wireless Keyboard

$129.95
Raspberry Pi 5 8GB

Raspberry Pi 5 8GB

$134.50
GMKtec Gaming PC, K11 AMD Ryzen 9 8945HS, 32GB DDR5 RAM 1TB Mini PC Desktop Computer, Oculink, Dual NIC 2.5GbE LAN, HDMI/DisplayPort/USB4*2

GMKtec Gaming PC, K11 AMD Ryzen 9 8945HS, 32GB DDR5 RAM 1TB Mini PC Desktop Computer, Oculink, Dual NIC 2.5GbE LAN, HDMI/DisplayPort/USB4*2

$739.99
Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community

KIWITATA 2X Classic SNES USB Controller for PC Gamings, Retro SNES Wired USB Game Emulator Controller for Windows XP 7 8 11 Mac Raspberry Pi

KIWITATA 2X Classic SNES USB Controller for PC Gamings, Retro SNES Wired USB Game Emulator Controller for Windows XP 7 8 11 Mac Raspberry Pi

$16.99
Bmax Mini PC B2 Power Intel 5205U 8GB DDR4 256GB M.2 NVMe SSD ,HDMI 1.4&DP 1.2, USB3.2,4K Dual Display 2.4G/5G WiFi & BT5.0 Mini Desktop Computers /Office/Design

Bmax Mini PC B2 Power Intel 5205U 8GB DDR4 256GB M.2 NVMe SSD ,HDMI 1.4&DP 1.2, USB3.2,4K Dual Display 2.4G/5G WiFi & BT5.0 Mini Desktop Computers /Office/Design

$169.99
Raspberry Pi 5 8GB

Raspberry Pi 5 8GB

$134.50