I’m a linux user (zorin-os distro) using the flatpak version of Visual Studio Code.
I have downloaded the necessary extensions (Python and Pylance).
I have selected my interpreter but there is something bothering me.
As you can see I have 4 interpreters available but firstly, my version of python is 3.8.10 and NOT 3.10.11 and secondly, the 2nd and 4th interpreter does not work because the file does not exist.
Another thing, if I type which python
in the shell then the result is usr/bin/python
but here the recommanded interpreter is bin/python
.
My questions are:
-
Why are there interpreters that do not exist? Can I remove them?
-
Why the version mismatch? Do I have to configure something?
-
Why is the recommanded interpreter not the same as the one used by my os? Is there any difference?
2
Answers
The problem was solved on its own. I don't know how but I may have an idea.
As I said in my conversation with @JialeDu (see above), my python vscode interpreters are located at
/var/lib/flatpak/runtime/org.freedesktop.Sdk/x86_64/22.08/ac3b29f9b04246d2b346de5632914232ee9c511702fc3c4e0d1c125a6de1e3ca/files/bin
and the folder "22.08" make me think that it needed ubuntu-22 to function properly (which wasn't present in zorin-os before version 16.3).So if it happens that you're using the distro zorin, maybe updating to the last version available will solve your problem.
Have a nice day !
There are duplicate or wrong interpreters due to caching etc, usually restarting vscode or refreshing the Select Interpreter panel will remove them.
No, the interpreter you choose in the Select Interpreter panel is the one used by the Python extension.
This explains where the extension will look for interpreters and how it will recommend an interpreter for the current workspace.
The interpreter selected in vscode is only valid for Python extensions. But there may be multiple python environments throughout the operating system, and the preferred interpreter will be related to your environment variable
path
.