I've faced the same issue and VSCode actually explains what is going on, and thanks to @Edster I could solve it.
TL:DR: Set defaultInterpreterPath
to a different value and reset it to python
The description for the option Edster mentioned is:
Path to default Python to use when extension loads up for the first time, no longer used once an interpreter is selected for the workspace. See https://aka.ms/AAfekmf to understand when this is used
And when you go to the link the important information is:
Changes to the python.defaultInterpreterPath will not be picked up by the Python extension once user explicitly chooses a different interpreter for the workspace. The extension will also not set nor change the value of this setting, it will only read from it.
In my case the project was loaded using the unversioned python symlink pointing to 3.9 and then I've downloaded 3.10 and updated my PATH to have python
pointing to 3.10, but when I did that since the value of defaultInterpreterPath
didn't change on VS code it didn't try to pick it up again.
My assumptions are that defaultInterpreterPath
doesn't store the symlink itself but where it points.
- Changing it to a different value and resetting the value to
python
fixed the issue for me, but I assume if you just disable/enable the Python extension on VSCode it should work.
Disclaimer:
These are just assumptions and I haven't tried them on my end, feel free to comment here the outcome if you try it or if you have anything to add.