Whenever I try to run a python file in VS Code, it gives me the error: zsh: command not found: python. Anyone know how to fix this?

Viewed 186

I am using the application vs code, and whenever I try to run a python file, it gives me the error:

zsh: command not found: python

I have the python extension and application installed on my computer. I am using a MacBook with the new M1 Chip.

The code is just:

print("Hello World")

Does anyone know how to fix this?

1 Answers

Because the command character used in MAC is python3 instead of python.

You can echo "alias python=/usr/bin/python3" >> ~/.zshrc in terminal to alias "python" with "python3".

You can refer to the document for more information about the use of vscode on macOS

Related