Published on

Manage Python Versions on Mac with Pyenv

Authors
  • avatar
    Name
    Gene Zhang
    Twitter

Use Pyenv

brew install pyenv
pyenv install 3.12.0
pyenv global 3.12.0

Set up your shell environment for Pyenv

For Zsh:

Run the following to add the commands to ~/.zprofile:

echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.zprofile
echo '[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.zprofile
echo 'eval "$(pyenv init -)"' >> ~/.zprofile