macOS安装最新版python
目录
[TOC]
去官网(https://www.python.org/downloads/macos/) 找 Download macOS 64-bit universal2 installer
pkg安装完了以后,在~/.bashrc
或者~/.zshrc
最后添加一行:
export PATH="/usr/local/bin:$PATH"
P.S. 因为macOS 15.1 自带的是Python 3.9.6,直接调用python3会调用到系统自带的/usr/bin/python3,所以需要修改 PATH 优先级
重新打开终端
顺便把pip安装了
curl -O https://bootstrap.pypa.io/get-pip.py && python3 get-pip.py
用python3 --version
查看版本号
$ python3 --version
Python 3.13.0
$ pip3 -V
pip 24.2 from /Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/pip (python 3.13)