Managing dependencies in Python with pipenv
A tutorial in buttet points
1 min readAug 11, 2019
- different applications may need different versions of the same library
- installing a dependency globally may result in conflicts
- a virtual environment contains local versions of Python and dependencies
- different applications can use different virtual environments
Definition of a virtual environment:
„A cooperatively isolated runtime environment that allows Python users and applications to install and upgrade Python distribution packages without interfering with the behaviour of other Python applications running on the same system.“ (Python glossary)
- pipenv is a tool that combines package and environment management
- install with brew install pipenv
- go into folder that will be used to hold all files for the project
- pipenv install [packagename]: Creates a Pipfile describing all dependencies together with a Pipfile.lock
- pipenv shell: Starts the virtual environment
- pipenv install: Will download and install all needed dependencies into the new environment
- exit: Exit the virtual environment
- pipenv lock -r: Creates a requirements.txt file for working without pipenv
For more inforamtion visit https://pipenv.readthedocs.io/en/latest/