Skip to main content

Create lightweight virtual environments in python.

# To create a Python virtual environment:
python -m venv <path/to/virtual_environment>

# To activate the virtual environment (Linux and macOS):
source <path/to/virtual_environment>/bin/activate

# To activate the virtual environment (Windows):
<path\to\virtual_environment>\Scripts\activate.bat

# To deactivate the virtual environment:
deactivate

# ----

# To delete a venv:
deactivate && rm -r venv

# To create a virtual environment in a directory called 'venv':
python -m venv venv