一、Python下载
https://www.python/downloads/
https://www.python/downloads/macos/

  • python3.8 默认安装地址
    /Library/Frameworks/Python.framework/Versions/3.8
/Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8
open  ~/.bash_profile

PATH="/Library/Frameworks/Python.framework/Versions/3.8/bin:${PATH}"
export PATH
export PATH="/usr/local/opt/python@3.8/bin:$PATH"
alias python="/Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8"

source ~/.bash_profile
(base) dulei@duleideMacBook-Pro bin % python -V      
Python 3.8.10

二、安装pip
pip将根据此Python版本安装
安装到python3.x下

// 下载pip
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
// 安装pip
sudo python3 get-pip.py
open  ~/.bash_profile

alias pip="/Library/Frameworks/Python.framework/Versions/3.8/bin/pip3.8"

source ~/.bash_profile
(base) dulei@duleideMacBook-Pro bin % which python3
/Library/Frameworks/Python.framework/Versions/3.8/bin/python3
(base) dulei@duleideMacBook-Pro bin % which pip3   
/Library/Frameworks/Python.framework/Versions/3.8/bin/pip3

更多推荐

MacOS 修改python默认版本 安装python3.8