I have many python versions installed. I need nevertheless that when using VSC the script be run by python3.10.7
. I changed accordingly the interpreter in VSC to the latest python version. The latest python version, python3.10.7
, is installed in the folder /user/bin
, while the one which I get with which python
is installed in a different folder, home/myname/anaconda3/bin/python
. I will appreciate your help. I use Ubuntu 20.4
. I do not have experience in using virtual environments. How do I change the interpreter to the latest one ? Thanks for your help.
Asked
Active
Viewed 33 times
0

user996159
- 149
- 6
-
[Virtual Environments](https://docs.python.org/3/library/venv.html) are your friend! – gvee Sep 27 '22 at 10:05
-
See also: https://stackoverflow.com/questions/45293436/how-to-specify-python-version-used-to-create-virtual-environment – gvee Sep 27 '22 at 10:07
-
I do not want to use virtual environments. – user996159 Sep 27 '22 at 10:08
-
Any particular reason why you don't want to use them? – alex Sep 27 '22 at 10:11
-
I find them complicated. I do not have the time to go through them. – user996159 Sep 27 '22 at 10:15
1 Answers
0
you can do it by opening the Command Palette using Ctrl+Shift+P and enter Preferences: Open User Settings. Then set python.defaultInterpreterPath, which is in the Python extension section of User Settings, with the appropriate interpreter.
-
I have done it as I pointed out at my post. The VSC is linked to the latest version. In the terminal however, when I check for the version used, I get `python3.9.7` instead of what VSC is linked to, `python3.10.7`. In fact, when I run some code that is supported only in `3.10.7`, I get an error message, showing that the code is not run by the interpreter I want. – user996159 Sep 27 '22 at 10:13
-
Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Sep 30 '22 at 15:42