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