0

When trying to run a Python file using Visual Studio Code's terminal window, it's in the format of python -u path_of_python_file but this does not do anything. What does do something is the py command, which runs the file normally.

How can I make it so that Visual Studio Code uses the py command and not python? For example, py C:\Users\...

I have searched for a setting that alters it but I cannot find one. My currently installed Python-related extensions are 'Python' and 'Code Runner' and I have Python 3.7, 64 bit installed. I have tried with a variety of programs including a simple 'hello world' program and it works fine on IDLE and on the command line (using 'py' not 'python').

With this question, I have no such option on the command palette.

Doot
  • 555
  • 5
  • 15
  • I've never seen a `py` executable (binary or script), but many called `python`. I wonder why the latter doesn't do anything on your system. – Ulrich Eckhardt Jan 26 '20 at 22:22

1 Answers1

2

You are using Code Runner to execute your code. If you disable the extension and use the Python extension to run your code instead it will use the Python interpreter you have selected (you will know when you're using the Python extension as the Play button will be green).

Brett Cannon
  • 14,438
  • 3
  • 45
  • 40