brew update
brew install pyenvgit clone https://github.com/pyenv/pyenv.git ~/.pyenvFor recent macOS versions, replace ~/.bash_profile with ~/.zshrc as the default shell is Zsh.
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.zshrc
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.zshrc
echo 'eval "$(pyenv init -)"' >> ~/.zshrc
source ~/.zshrcexec "$SHELL"pyenv install --listpyenv install 3.10pyenv global 3.10eval "$(pyenv init --path)"
python3 --version