- you need pyenv
brew install pyenv
- add pyenv path
echo 'export PATH="$(pyenv root)/shims:$PATH"' >> ~/.zshrc
- install python version
pyenv install --list | grep 3.X.Y
pyenv install 3.X.Y
python-build: use openssl@1.1 from homebrew
python-build: use readline from homebrew
Downloading Python-3.X.Y.tar.xz...
-> https://www.python.org/ftp/python/3.X.Y/Python-3.X.Y.tar.xz
Installing Python-3.X.Y...
python-build: use readline from homebrew
python-build: use zlib from xcode sdk
Installed Python-3.X.Y to /Users/<user>/.pyenv/versions/3.X.Y
- list installed python versions
pyenv versions
- if you want to change the default version
pyenv global 3.X.Y
Source: https://installvirtual.com/how-to-install-python-3-8-on-mac-using-pyenv/