Imagine that you have two projects—project A and project B—whose Python library requirements conflict. For instance, project A needs scikit-learn version 0.21, while project B requires scikit-learn versions >0.22. Or maybe one project requires Python 3.6 and the other Python 3.7. You could uninstall and then install the appropriate libraries or Python as you switch from one project to the other, but that can get tedious and impractical. To solve the problem of conflicting requirements, we recommend using Python virtual environments. You will see how to use a Python virtual environment in this recipe.
Using Python virtual environments
Getting ready
The module for virtual environments, venv, is included in the...