Installing stand alone command line tools¶
Many packages provide command line applications. Examples of such packages are mypy, flake8, black, and Pipenv.
Usually you want to be able to access these applications from anywhere on your system, but installing packages and their dependencies to the same global environment can cause version conflicts and break dependencies the operating system has on Python packages.
pipx solves this by creating a virtual environment for each package, while also ensuring that its applications are accessible through a directory that is on your $PATH. This allows each package to be upgraded or uninstalled without causing conflicts with other packages, and allows you to safely run the applications from anywhere.
Note
pipx only works with Python 3.6+.
pipx is installed with pip:
Note
ensurepath ensures that the application directory is on your $PATH. You may need to restart your terminal for this update to take effect.
Now you can install packages with pipx install and run the package’s applications(s) from anywhere.
For example:
To see a list of packages installed with pipx and which applications are available, use pipx list:
To upgrade or uninstall a package:
pipx can be upgraded or uninstalled with pip:
pipx also allows you to install and run the latest version of an application in a temporary, ephemeral environment. For example:
To see the full list of commands pipx offers, run:
You can learn more about pipx at https://pipx.pypa.io/.