This borrows from https://jordanthomasg.medium.com/python-development-on-macos-with-pyenv-2509c694a808.
Install Homebrew if necessary.
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Before installing pyenv do the following: