Virtual environments allow the user to manage dependencies across multiple projects. Some projects might require different versions of different packages.
To create a virtual environment, we use a tool called venv.
First, create a new directory that will contain the virtual environment.
mkdir .venv
Proceed to create the virtual env using this command
python -m venv .venv
Finally, we need to activate the virtual environment using on Unix or Mac:
source .venv/bin/activate
and on Windows:
.\.venv\Scripts\activate
Now the dependencies can be safely installed
pip install -r requirements.txt