在Mac电脑上找到Python的方法如下:
查看自带Python版本
打开`/System/Library/Frameworks/Python.framework/Versions`文件夹。
`Current`文件夹中存放的是系统当前使用的Python版本。
进入`Current/bin`目录,运行`./python --version`查看当前Python版本。
使用Homebrew安装Python (如果未安装):打开终端,运行`brew install python@3.10`安装指定版本的Python。
对于Apple Silicon,路径为`/opt/homebrew/Cellar/python@3.10/*/bin/python3`。
查找Python安装路径
使用`find`命令查找Python安装路径:`find /usr -name "python3*"`。

对于通过Homebrew安装的Python版本,使用`ls /usr/local/Cellar/python@3.10/*/bin/python3`或`ls /opt/homebrew/Cellar/python@3.10/*/bin/python3`。
创建符号链接(如果需要):
创建符号链接以便通过`python`或`python3`命令访问特定版本的Python。
检查SHELL环境
输入`echo $SHELL`查看当前SHELL环境,确认使用的是`.zsh`还是`.bash`。
如果是`.zsh`,编辑`~/.zshrc`文件,添加Python路径别名。
如果是`.bash`,编辑`~/.bash_profile`或`~/.bashrc`文件,添加Python路径别名。
使用VSCode
在VSCode中,设置`code runner`插件,以便在终端中直接运行Python脚本。
以上步骤可以帮助你在Mac电脑上找到并使用Python。
