2

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?

Yuchen Ren
  • 287
  • 5
  • 13
Emmett
  • 21
  • 2
  • Yes. Have you tried pasting that exact error in a search engine? – I break things May 27 '22 at 00:59
  • [how-to-fix-zsh-command-not-found-python-error-macos-monterey-12-3-python](https://stackoverflow.com/questions/71591971/how-to-fix-zsh-command-not-found-python-error-macos-monterey-12-3-python) – Mohamad Ghaith Alzin May 27 '22 at 01:00
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community May 27 '22 at 01:16

1 Answers1

1

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

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