VS Code does not change python environment

Question:

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.

Asked By: vedant dave

||

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
Answered By: SupremeDeity

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

Answered By: user13824946

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

Answered By: smoothumut

For those who have tried these steps:

  • select different interpreter
  • reboot VScode
  • reinstall VScode Python extension and delete its folders

and have achieved nothing.

Probably you are working in the workspace and not in folder. You may have set interpreter at workspace level, which can’t be used in one of the folders of the workspace. Try opening your folder separately from the workspace and select interpreter you want. This worked for me.

Answered By: TaskerBliss