pipx is a fantastic tool for installing and running Python command-line applications in isolated environments — without polluting your system Python or needing to activate virtual environments every time.
Think of it as:
brew / apt / choco but only for Python CLI toolsnpx in the JavaScript world| You want to... | Normal way (messy) | With pipx (clean) |
|---|---|---|
| Use black, poetry, httpie, yt-dlp, etc. | pip install --user ... → global pollution | pipx install black → isolated + on PATH |
| Try a tool once | create venv, activate, install | pipx run black ... (no install!) |
| Upgrade tools | remember which ones you have | pipx upgrade-all |
Most common & recommended methods in 2025–2026:
# Best / most maintained way
python3 -m pip install --user pipx
python3 -m pipx ensurepath
After the last command close and reopen your terminal (or run source ~/.bashrc / equivalent).
Alternative one-liners many people use:
# macOS / Linux (very popular)
brew install pipx # if you have Homebrew
sudo apt install pipx # Ubuntu 23.04+
sudo dnf install pipx # Fedora
scoop install pipx # Windows + Scoop
choco install pipx # Windows + Chocolatey
| Command | What it does | Example |
|---|---|---|
pipx install PACKAGE | Install app + put binaries on PATH | pipx install black |
pipx run PACKAGE | Run once (temporary env — no install) | pipx run cowsay hello |
pipx run --spec GIT_URL ... | Run directly from git | pipx run --spec git+https://github.com/... |
pipx list | Show all installed tools | — |
pipx upgrade PACKAGE | Update one tool | pipx upgrade poetry |
pipx upgrade-all | Update everything | — |
pipx uninstall PACKAGE | Remove tool + its isolated venv | — |
pipx reinstall PACKAGE | Reinstall (useful after Python upgrade) | — |
pipx inject PACKAGE EXTRA | Add extra package into existing tool's venv | pipx inject black isort |
# Install popular tools
pipx install poetry # dependency management
pipx install black # code formatter
pipx install ruff # fast linter / formatter
pipx install httpie # modern curl-like tool
pipx install yt-dlp # youtube downloader
pipx install glances # system monitor
pipx install commitizen # conventional commits
# Run once without installing
pipx run speedtest-cli
# Try pre-release / git version
pipx install --force git+https://github.com/psf/black.git@main
# Upgrade everything once a month
pipx upgrade-all
pipx upgrade-all regularly — most Python CLI tools update frequentlypipx install black
pipx inject black isort
pipx reinstall-allpipx install black --suffix=-py
# → now you run black-py instead of black
~/.local/bin (or equivalent) is on PATHOfficial docs (very readable): https://pipx.pypa.io/stable/