Correctly Install Python on MacOS #

Last updated March 17, 2026
macospythoncircuitpython

Python on Mac is a pain because there are so many different ways to do it. I've found that pyenv is the best way to manage python versions on MacOS

# install pyenv
brew install pyenv pyenv-virtualenv

# list all available python variants
pyenv install -l

# install latest 3.x.x python
pyenv install 3 

# add to the shell
echo 'PATH=$(pyenv root)/shims:$PATH' >> ~/.zshrc

Now restart your shell / open a new terminal window.

You can manage python with these commands:

  • See the current global version: pyenv versions
  • See where the current python versions come from: pyenv versions
  • See what is the current local version: pyenv local
  • List all possible versions of python to install pyenv install --list
  • Install (download and build) a particular version of python pyenv install 3.12.8
  • Set the current local version to 3.12.8: pyenv local 3.12.8