Thursday, December 19, 2024

Uninstalling python from windows where no uninstaller can be found

1. Find out the exact version installed for the package you want to remove. In this case 3.12:
PS > py --list
 -V:3.13 *        Python 3.13 (64-bit)
 -V:3.12          Python 3.12 (64-bit)
PS > py -3.12 --version
Python 3.12.0
2. Find out where the executable is for that version, in this case it is in C:\Program Files\Python312\python.exe:
PS > py -3.12 -c "import sys; print(sys.executable)"
C:\Program Files\Python312\python.exe
3. Delete the root folder containing the executable to remove that python version:
PS > Remove-Item -Path "C:\Program Files\Python312" -Recurse -Force
4. Remove registry entries for that installation (you should find 3.12 as an entry in our case in one or the two places below):
Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\
and/or
Computer\HKEY_CURRENT_USER\SOFTWARE\Python\PythonCore\
5. Confirm the only version installed is the one you expect. In our case we expect only 3.13:
PS > py --list
 -V:3.13 *        Python 3.13 (64-bit)

No comments:

Followers