There are several ways to isolate Python at runtime. The simplest and most obvious, although hardest to maintain, is to manually change the PATH and PYTHONPATH environment variables and/or move the Python binary to a different, customized place where we want to store our project's dependencies, in order to affect the way that it discovers available packages. Fortunately, there are several tools available that can help in maintaining the virtual environments and packages that are installed for these environments. These are mainly virtualenv and venv. What they do under the hood is, in fact, the same that we would do manually. The actual strategy depends on the specific tool implementation, but generally they are more convenient to use and can provide additional benefits.
To create new virtual environment, you can simply use the following command:
python3...