Python Venv is a built-in tool to create and manage lightweight virtual environments.
For more information visit: venv tutorial.
Installation:
Already installed on MacOS and Windows platforms, but needs to be installed on some Linux distros, here is an installation guide for different package managers:
sudo apt install python3-env # using apt
sudo dnf install python3-env # using dnf
sudo pacman -S python3-env # using pacman
sudo dnf install python3-env # using dnf
sudo pacman -S python3-env # using pacman
Creating a Virtual Environment:
python -m venv <env_name> # Unix-like systems
python -m venv <env_name> # windows
python -m venv <env_name> # windows
Activating the Virtual Environment:
On Unix-like systems (Unix, Linux, or MacOS):
source <env_name>/bin/activate
On Windows:
<env_name>Scriptsactivate
Deactivating the Virtual Environment:
deactivate