python -m venv .venvLine-by-line explanation
- Python runs its built-in
venvmodule. .venvis the folder to create.- That folder receives an isolated interpreter and package location.
Activate it in Windows PowerShell:
.venv\Scripts\Activate.ps1Line-by-line explanation
- The path points to the environment’s PowerShell activation script.
- Running it changes the current terminal session.
- The prompt normally gains
(.venv).
Activate it on macOS or Linux:
source .venv/bin/activateLine-by-line explanation
sourceruns changes in the current shell.- The path selects the environment’s activation script.
- The prompt normally gains
(.venv).