My Python environment in Visual Studio 2022 is completely broken due to a past misconfiguration, and I try to find ways to debug it.
When I launch Python through PowerShell from desktop, I have no problem.
However, when I launch Python from Visual Studio 2022, it automatically sets the environment variable PYTHONHOME to "C:\Python311," which was an old folder that I deleted and don't use anymore. Due to this, my Python environment is broken across all projects.
I have tried to do the following without success:
[System.Environment]::SetEnvironmentVariable("PYTHONHOME", "", [System.EnvironmentVariableTarget]::Machine)
in the PowerShell launched from Visual Studio.C:\Users\username\AppData\Local\Microsoft\VisualStudio
devenv.exe /ResetSettings
(see here)My understanding is that Visual Studio uses a misconfigured file defined somewhere in my system when launching Python, which automatically sets PYTHONHOME="C:\Python311". I would like to know where this script file is so that I can reconfigure PYTHONHOME to null. It is not project-specific but global.
If you need more information, please let me know; I will update my question accordingly.
I would have never thought the problem would be in my vsvim config file! I just deleted the following line:
let $PYTHONHOME = 'C:\Python311'