2

How can I use Python 3.7 in my command line?

My Python interpreter is active on Python 3.7 and my python.pythonPath is /usr/local/bin/python3, though my Python version in my command line is 2.7. I've already installed Python 3.7 on my mac.

lorenzs-mbp:Python lorenzkort$ python --version
Python 2.7.13
lorenzkort
  • 73
  • 1
  • 10

3 Answers3

2

If you open tab "Terminal" in your VSCode then your default python is called (in your case python2).

If you want to use python3.7 try to use following command:

python3 --version

Or just type the full path to the python folder:

/usr/local/bin/python3 yourscript.py

In case you want to change default python interpreter, then follow this accepted anwser: How to set Python's default version to 3.x on OS X?

BraveDistribution
  • 445
  • 1
  • 4
  • 18
0

You should use python3 instead of python for running any commands you want to run then it will use the python3 version interpreter.

Also if you are using pip then use pip3.

Hope this helps.

Saket
  • 836
  • 6
  • 13
0

This gives you a complete guide in setting up Visual Studio code for python Getting Started with Python in VS Code