VS Code does not change python environment

Viewed 9139

I am using VS-Code and anaconda environment for python interpreter. I select the exact anaconda base environment by ctrl + shift + ` and it also reflects in the downside panel of vscode. But, when I checked the python version it shows my system's default python environment 3.7.9. If you see the below screenshot than, the anaconda environment is with 3.8.3.

Please give me solution, enter image description hereThank you.

3 Answers

Changing the version in VSCode does not change the the instance that your PS instance will use. Try doing where python to see where the V3.7.9 that your PS instance is picking up is. Then remove that version from the environment variables and add the path to the V3.8.3 instead.

Additionally you can do: To forcefully use v3.8.3

  1. Specify python version in command
py -3.8 <command>
  1. OR set PY_PYTHON environment variable to set which version to use. Take a look at this for further help Python docs

after changing the environment, you can restart the vs code again. it might be changed now. if not, then try changing now againg by clicking the interpreter name which is displayed on left bottom of the vscode window

To check & change vs code interpreter:

  • In top left menu bar Click view
  • In the dropdown menu, Click Command Palette
  • Click Python: Select Interpreter
  • Choose & Click on your desired Interpreter

Another way to be sure to use anconda interpreter, open anaconda navigator and launch vs code from there.

original vs code How-To

Related