PyEnv to Manage Multiple Python Versions (MacOS)

If, after following the installation directions for PyEnv at https://github.com/pyenv/pyenv#homebrew-on-macos, you run into an issue setting your python version for ‘global’, ‘local’, or ‘shell’ and you are using ZSH as you shell rather than BASH, there is a good possibility you either:

  1. Made the obvious mistake of not switching out which shell you are using from BASH to ZSH in all of your installation commands as noted in the instructions (common mistake)

or (what I ran into)

  1. The installation commands found in the installation guide failed to place the necessary shell scripts in the proper file for ZSH for your particular setup. I found that moving the shell scripts from my ~/.zshenv file to the bottom of my ~/.zshrc file solves this problem and I can once again properly set the python version I want to use using ‘pyenv global 3.8.1’. Now when I check the version ‘python –version’ in my terminal (I use iterm), I get 3.8.1 as expected.