pyenv is a tool that can be used to easily enable and switch between multiple versions of Python.

It can be installing with:

[MacOS]

  1. Install via Homebrew

pyenv can be installed with Homebrew with the following command:

# Requires admin privileges
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Note: If you don’t have Xcode Command Line installed yet, this step will request confirmation and install it.

  1. Install pyenv:

brew install pyenv 
  1. Install Python (CodeFlare has been tested with 3.8.6):

pyenv install 3.8.6
  1. Set global default:

pyenv global 3.8.6

and verify it worked:

pyenv version
3.8.6 (set by /Users/<user>/.pyenv/version)
  1. Set up shell path:

Add the following to your ~/.bash_profile (Note: you may have to create the the file)

export PYENV_ROOT="$HOME/.pyenv" 
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init --path)"

eval "$(pyenv init -)"

You will have to source your profile for changes to take affect:

source ~/.bash_profile
  1. Confirm Python version

python --version
Python 3.8.6