Essentially Pipenv is
virtualenv and it’s a match made in heaven. It manages dependencies, required python versions (if pyenv is available), generates pipfiles which is more reliable than a
requirements.txt file and it generates a virtual environment so you don’t screw other environments and its requirements.
It automatically creates and manages a virtualenv for your projects, as well as adds/removes packages from your Pipfile as you install/uninstall packages. It also generates the ever–important Pipfile.lock, which is used to produce deterministic builds.
— From Pipenv Repository
and it is officially recommended by Python.org:
While pip alone is often sufficient for personal use, Pipenv is recommended for collaborative projects as it’s a higher-level tool that simplifies dependency management for common use cases.
pip install --user pipenv
--three to specify the environment’s python version.
Creating a virtualenv for this project…
requests as an example
pipenv install requests
We can execute our python program without activating the virtual environment shell by running
pipenv run python _pythonfile.py_ or accessing the virtual environment with
Spawning environment shell (/usr/bin/fish). Use 'exit' to leave.
Displays package information and versions.
It generates a
json file with our environment dependencies.
Removing virtualenv (/home/franccesco/.local/share/virtualenvs/test-PudGTmiz)…
You can find more documentation at Pipenv Guthub repo