Uninstall every Python version and the Python Launcher (py.exe) through Windows Installed apps, delete leftover installation folders (LocalAppData\Programs\Python and C:\Python*), clear global pip caches (LocalAppData\pip and AppData\Python), and remove stale Python entries from both your User and System PATH environment variables—then open a brand-new terminal and run where python to verify that zero Python executables remain on your system.
Basic Example
# 1. Recommended: Uninstall via Windows Settings (`ms-settings:appsfeatures`),
# OR run `winget` in PowerShell to remove all detected Python installations:
winget list --name Python
winget uninstall --id Python.Python.3.12 --silent
winget uninstall --id Python.Launcher --silent
# 2. Delete leftover Python installation directories, user site-packages, and pip caches:
Remove-Item -Recurse -Force "$env:LocalAppData\Programs\Python" -ErrorAction SilentlyContinue
Remove-Item -Recurse -Force "$env:LocalAppData\pip" -ErrorAction SilentlyContinue
Remove-Item -Recurse -Force "$env:AppData\Python" -ErrorAction SilentlyContinue
Remove-Item -Recurse -Force "C:\Python*" -ErrorAction SilentlyContinue
# 3. Clean stale Python paths from the User PATH variable safely via PowerShell:
$userPath = [Environment]::GetEnvironmentVariable("Path", "User")
$cleanedPath = ($userPath -split ";" | Where-Object {
$_ -and ($_ -notmatch "\\Python\\Python\d+" -and $_ -notmatch "^C:\\Python\d+")
}) -join ";"
[Environment]::SetEnvironmentVariable("Path", $cleanedPath, "User")
Key Details & Edge Cases
- Uninstall both
Python 3.xANDPython Launcherin Windows Settings:- Press
Win + I$\rightarrow$ Apps $\rightarrow$ Installed apps, search forPython, and uninstall everyPython 3.x (64-bit)entry plus the standalonePython Launcherentry (which placespy.exeinsideC:\Windows\py.exe). IfPython Launcherremains installed, typingpyin Command Prompt or PowerShell will still resolve even after all Python interpreters are deleted.
- Press
- Check all four common leftover directory locations on Windows:
- Per-user default install path:
LocalAppData\Programs\Python(e.g.,C:\Users\<user>\AppData\Local\Programs\Python\Python312\) - All-users / custom root install path:
C:\Program Files\Python*orC:\Python* - User
--userpackages & scripts:AppData\Python(e.g.,C:\Users\<user>\AppData\Roaming\Python\Python312\Scripts\) pipwheel & HTTP cache:LocalAppData\pip
- Per-user default install path:
- Remove stale entries from both User
Pathand SystemPath(sysdm.cpl):- Press
Win + R, typesysdm.cpl, press Enter $\rightarrow$ Advanced tab $\rightarrow$ Environment Variables…. - Edit
Pathunder User variables ANDPathunder System variables, deleting any entry ending in\Python\Python3xx\or\Python\Python3xx\Scripts\(or%AppData%\Python\Python3xx\Scripts). - Also check whether a standalone
PYTHONPATHorPYTHONHOMEenvironment variable exists in that dialog and delete it if present.
- Press
- Disable the built-in Windows Store
python.exeApp Execution Alias:- Even after a complete uninstall, running
where pythonon Windows 10/11 often printsC:\Users\<user>\AppData\Local\Microsoft\WindowsApps\python.exe(a 0-byte stub that opens the Microsoft Store). Disable it via Settings $\rightarrow$ Apps $\rightarrow$ Advanced app settings $\rightarrow$ App execution aliases and toggle App Installer (python.exeandpython3.exe) to Off.
- Even after a complete uninstall, running
- Verify in a newly opened terminal window:
- Existing PowerShell/CMD windows cache the old
PATHin memory. Close all terminals, open a fresh PowerShell window, and verify withwhere.exe pythonandwhere.exe py—both should returnINFO: Could not find files for the given pattern(s).
- Existing PowerShell/CMD windows cache the old
Comparison of Windows Python Cleanup Steps & Targets
| Cleanup Target | Exact Windows Location / Command | Removed Automatically by Uninstaller? | Best Used When |
|---|---|---|---|
| Core Interpreter & Stdlib | Settings $\rightarrow$ Installed apps (Python 3.x & Python Launcher) |
Yes (leaves modified Scripts/ packages behind) |
First step of every Python removal on Windows. |
Leftover Install & Scripts/ Folders |
LocalAppData\Programs\Python, C:\Program Files\Python*, AppData\Python |
No (directories with third-party pip packages remain) |
Preventing ghost pip.exe / old site-packages collisions on reinstall. |
pip Download & Wheel Cache |
LocalAppData\pip |
No | Reclaiming gigabytes of disk space or clearing corrupt cached wheels. |
Stale PATH & PYTHONPATH Entries |
sysdm.cpl $\rightarrow$ Environment Variables (User & System Path) |
Partially (custom or --user Scripts paths often remain) |
Eliminating broken PATH lookups and ensuring a clean slate before reinstalling Python. |
| Windows Store Stub Aliases | Settings $\rightarrow$ Apps $\rightarrow$ App execution aliases (python.exe) |
No (built into Windows 10/11) | Stopping Windows from hijacking python commands to launch the Microsoft Store. |
You must log in or register to comment.
