Manage Python Version With Pyenv

There is problem managing python version with your package manager. An easy solution is to use pyenv:

  1. Install pyenv with your package manager. For MacOS, it’s brew install pyenv.
  2. Install desired python version: pyenv install <version>
  3. Set global python version pyenv global <version>
  4. Set up your shell environment for Pyenv, for zsh, add this to your .zshrc:
export PYENV_ROOT="$HOME/.pyenv"
command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"