Python venv Troubleshooting Cheat Sheet/Delete and recreate on PowerShell

Rebuild from scratch on Windows.

Section: Full environment reset

Delete and recreate on PowerShell

powershell
powershell
Remove-Item -Recurse -Force .venv; py -m venv .venv; .venv\Scripts\Activate.ps1; python -m pip install -U pip setuptools wheel; python -m pip install -r requirements.txt
Explanation

PowerShell equivalent of a full environment rebuild.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Full environment reset
Delete and recreate on POSIX
Start fresh from requirements.
OpenIn sheetbashsame section
Confirm imports after rebuild
Smoke-test a rebuilt environment quickly.
OpenIn sheetbashsame section
Run Activate.ps1
Activate from PowerShell.
OpenIn sheetpowershell1 tag match
Allow local PowerShell scripts
Fix execution policy for venv activation scripts.
OpenIn sheetpowershell1 tag match
Find python on POSIX
See which python binary your shell resolves first.
Activate using bash syntax
Source the activate script in bash or zsh.