简体   繁体   中英

When I run python code in vs code I get this error: zsh: command not found: python

I'm using mac os but, from 4 months ago there was an update for Mac, and I was working in vscode normally with Python, but when the update finished downloading, vscode never worked with any Python code, but the rest of the languages were working normally, I tried a lot but i didnt get anything so i downloaded pycharm but i like vscode can anyone help me.

my input:

print("Hello, World")

output:

zsh: command not found: python

my python version:

name@name ~ % python3 --version
Python 3.10.7
name@name ~ % 

There is python3 on your machine, but the python command of the mac system points to python2 by default. You need to use the following command to point python to python3.

echo "alias python=/usr/bin/python3" >> ~/.zshrc

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM