Virtual Environments
They’re like worlds in which you can run and test code. In such a world, you can have specific versions of different packages installed, to ensure compatibility, and so you can keep your global environment clean.
Basically it isolates your development/testing environment.
How do I make one?
python3 -m venv env
with “env” being the name of your environment.
How do I start using it?
source env/bin/activate
and to get out of the environment:
deactivate
How does it work?
Running the first command will create a folder called env. In this folder are a few important items, namely “bin” and “lib”
bin
The bin folder contains lots of executables which tell your environment what to do when you run certain commands. pip3, easy_install, and python3 are some of these executables you will get by default.
lib
The lib folder contains all the packages you install inside the environment. Find them in lib/python3.x/site-packages/.