Working with virtual environments is a good practice to keep your project dependencies isolated from other projects. This way you can have different versions of the same package in different projects.
- Create a virtual environment
python -m venv <name_of_the_virtual_environment>
# Example
python -m venv venv
- Activate the virtual environment
.\<name_of_the_virtual_environment>\Scripts\activate
# Example
.\venv\Scripts\activate
In windows using powershell
.\<name_of_the_virtual_environment>\Scripts\Activate.ps1
# Example
.\venv\Scripts\Activate.ps1
- Exits the virtual environment
deactivate
- To remove the virtual environment
rm -r venv