0

In VScode, the result given from "python --version" on terminal is different than the version that I am in according to the command prompt. The terminal says that I'm in 2.7.16 when I should be in 3.11.2 according to the command prompt.

I tried to do "python3 --version" but that gave me version 3.7.7. I'm confused as to why they are different. I have a macbook.

I also tried:

python -c 'import sys; print(".".join(map(str, sys.version_info[:3])))'
Albina
  • 1,901
  • 3
  • 7
  • 19
Lee
  • 1
  • 2
  • This isn't so much a Python question as just how your PATH and shell are setup. Clearly you have multiple Python installations (quite common and not itself a problem) and different ones are being referenced in different contexts. So what's your question? – Kache May 19 '23 at 06:32
  • this question has been asked so many times https://stackoverflow.com/q/60836646/11107541 https://stackoverflow.com/a/72432622/11107541 https://stackoverflow.com/q/66670568/11107541 – starball May 19 '23 at 06:42
  • VS code (and in fact most good editors) let the user select which version of the language (in this case Python) that they want to use... – D.L May 19 '23 at 06:49

1 Answers1

0

If you would prefer to select a specific environment, use the Python: Select Interpreter command from the Command Palette (Ctrl+Shift+P).

enter image description here

The Python: Select Interpreter command displays a list of available global environments, conda environments, and virtual environments.

Read document about python environment for more details.

MingJie-MSFT
  • 5,569
  • 1
  • 2
  • 13