The python interpreter that I choose is python 3.7.16(tf:conda )which is set by anaconda. And its path in my computer is F:anacondaenvstfpython.exe.
In the user’s setting.json , I changed the interpreter path to F:anacondaenvstfpython.exe.
But when I run my code in vscode, it uses a different interpreter other than the one that I chose, and its path is F:python python 310 python.exe
2
Answers
It is because your environment path of python is set to "F:python python 310 python.exe". You have to replace this path with the path you want in your Operation System environment path.
Obviously you are using Code Runner to run the code. This is incorrect, because selecting an interpreter is a feature of Python extension, so the interpreter you choose is only valid for Python extensions (that is, the actual interpreter version in the lower right corner).
If there is no special requirement, please use the official extension Python to execute the script.
The
Run Code
option is brought by Code RunnerCode Runner does not use the settings made for the Python extension, so it executes the script using the python version configured by the system environment variable.