xxxxxxxxxx
1. Run this command on PowerShell to see which .exe is being executed for
the Python command:
> Get-Command python | fl *
2. Go to that folder where the .exe (there might usually be other adjacent
.exe files there like python.exe, python3.10.exe, python3.12.exe, …) lives.
3. Check if there are other folders relating to each of the different python
version installations. For example:
C:\Users\[user]\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.10_qbz5123fra8gh
C:\Users\[user]\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.12_qbz5123fra8gh
4. Run command following command:
> Trace-Command –Name CommandDiscovery –Expression {get-command python} -PSHost
This checks which folder from the PATH rows have the "python command"
executable. It will first search the System PATH, then it will check the
user-specific PATH.
5. Whichever row of the PATH variable (System or user, you'll have to see
from step 4) is being used to point to the python command, edit that row so
that it points to the respective folder of the Python version you wish to
use.
Commands from: https://stackoverflow.com/questions/42407894/python-version-in-powershell