Notes

Python 3.x on macOS

Edit on GitHub

Python

The official Python 3.9.2 installer is not yet available for Apple Silicon Macs. pyenv is a better approach because it also lets you install and switch between multiple versions.

1brew install pyenv
2
3# Add pyenv init to your shell to enable shims and autocompletion.
4echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n  eval "$(pyenv init -)"\nfi' >> ~/.zshrc
5source ~/.zshrc
6
7# install python version
8pyenv install 3.9.2

You can see all installed versions with pyenv versions and set a version with pyenv global 3.9.2

1pyenv versions
* system (set by /Users/aamnah/.pyenv/version)
  3.9.2
pyenv global 3.9.2
pyenv version
# 3.9.2 (set by /Users/aamnah/.pyenv/version)

python --version
# Python 3.9.2