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])))'
3
  • 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? Commented May 19, 2023 at 6:32
  • this question has been asked so many times stackoverflow.com/q/60836646/11107541 stackoverflow.com/a/72432622/11107541 stackoverflow.com/q/66670568/11107541 Commented May 19, 2023 at 6: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... Commented May 19, 2023 at 6:49

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.