venv: Python virtual environment
How to setup and use venv to create virtual environments in Python.
Overview
Virtual environments enable us to manage project-specific dependencies in python using venv.
For windows users, the virtual environment may be setup in powershell using:
python -m venv .venv
Before using it, you may first need to change execution policies in Powershell:
Set-ExecutionPolicy Unrestricted -Scope Process
Activate the virtual environment in PowerShell by running:
.venv\Scripts\Activate.ps1
Success is visible when the path begins with (.venv)
You can close the virtual environment with:
deactivate
QED
© Adam Heinz
3 June 2024