Managing Python virtual environments
with venv
A virtual environment is a self-contained directory tree containing a Python interpreter for a particular version of Python, a pip
executable for managing project dependencies, and a local site-packages
directory. Switching between virtual environments tricks the shell into thinking that the only Python and pip
executables available are the ones present in the active virtual environment. Best practice dictates that you create a different virtual environment for each of your projects. This form of isolation solves the problem of two projects depending on different versions of the same package.
Virtual environments are not new to Python. The system-wide nature of Python installations necessitates them. Besides enabling you to install different versions of the same package, virtual environments also provide an easy way for you to run multiple versions of the Python interpreter. Several options exist for managing Python virtual environments...