THE FOUNDER’S GUIDE:
How to Install Multiple Versions of Python With Pyenv on MacOS
The expanded tutorial with explanations and screenshots

“The condensed version of this article uses copy and paste code to help you get the outcome ASAP ⚡”
Open Terminal:
The Terminal is a program that’s included with macOS that provides users with access to the operating system using a command-line interface. It uses Z shell by default which replaced Bourne Again Shell as the system shell. It can also work with other shells like Korn, Tenex C, and Bourne Again Shell.
- Press “Command ⌘ + Spacebar”
- Enter “Terminal”
- Press “Return”

Check the Default Version:
The Version (V) option is used to check which version of Python is currently selected as the default version. It consists of three numbers separated by periods that represent the major, minor, and micro version number. It also displays an error message if Python isn’t already installed on the computer.
- Copy the command from below these instructions
- Paste the command into Terminal
- Press “Return”
python --version

Check the Executable File:
The Which command is used to identify the location of the executable file for the specified command name. It searches for the executable file in the list of directories from the PATH environment variable. It also displays the absolute path of the executable file if it exists in the one of the directories.
- Copy the command from below these instructions
- Paste the command into Terminal
- Press “Return”
which python

Install Homebrew:
Homebrew is a package manager that provides access to thousands of programs on macOS. It manages the entire installation process which includes downloading, compiling source code, moving files, installing dependencies, creating symbolic links, and deleting installation files.
- Copy the command from below these instructions
- Paste the command into Terminal
- Press “Return”
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Install Pyenv:
Pyenv is a program that’s used for Python version management on macOS and Linux. It can install multiple Python versions, specify the version that’s used system-wide, and specify the version that’s used in specific directories. It can also create and manage virtual environments using specific versions.
- Copy the command from below these instructions
- Paste the command into Terminal
- Press “Return”
brew install pyenv

View the Python Versions:
The List (l) flag is used to display the Python versions that are available in Pyenv. It includes final versions that are released from Python, Anaconda, PyPy, Jython, and Stackless. This includes all the major, minor, and micro versions but it doesn’t include alpha, beta, or release candidate versions.
- Copy the command from below these instructions
- Paste the command into Terminal
- Press “Return”
pyenv install --list

Install Python:
Python is an object-oriented language that’s known for its simple syntax, code readability, and English-like commands. It gets used for web, back end, and software development but it’s become one of the most popular languages for artificial intelligence, machine learning, and data science.
- Select any version from below these instructions
- Copy the provided command
- Paste the command into Terminal
- Press “Return”
- Repeat
Python 3.5:
pyenv install 3.5.10Python 3.6:
pyenv install 3.6.12Python 3.7:
pyenv install 3.7.9Python 3.8:
pyenv install 3.8.6

Set the Default Python Version on the System:
The Global command is used in Pyenv to specify the default Python version for the entire system. It creates a text file in the Pyenv directory that stores the specified version. This is used by Pyenv to activate the default version but it gets overwritten by the local Pyenv text file and environment variable.
- Copy the command from below these instructions
- Paste the command into Terminal
- Press “Return”
pyenv global 3.8.6

Open the Home Directory:
The Change Directory (cd) command is used to change the current working directory to the specified directory. It can navigate to absolute and relative paths that start from the root and current working directory, respectively. It can also navigate to paths stored in variables and environment variables.
- Copy the command from below these instructions
- Paste the command into Terminal
- Press “Return”
cd ~

Create the Zsh Configuration File:
The Echo command is used to print text it receives from an argument to the screen or to a computer file. It can be used in shell scripts and batch files to print the output of other commands or as part of other commands to insert text. It can also save over the text in an existing file or append it at the end.
- Copy the command from below these instructions
- Paste the command into Terminal
- Press “Return”
echo "" >> .zshrc

Open the Zsh Configuration File:
The Shell Configuration File is a script that’s automatically executed when a shell is opened by the user. It contains code that’s used to change the look of the shell, run scripts and commands, create aliases, and load environment variables. It also creates a separate configuration file for each of the shells.
- Copy the command from below these instructions
- Paste the command into Terminal
- Press “Return”
open -a textedit ~/.zshrc

Edit the Zsh Configuration File:
Z Shell is an interactive shell that’s used as a login shell and a command interpreter for shell scripting. It provides an extended version of Bourne Again Shell which contains features from Bourne Again Shell, Korn, and Tenex C. It also includes many original features like plugins and themes.
- Copy the code from below these instructions
- Paste the code into TextEdit
- Click the “File” menu
- Click “Save”
# Pyenv initialization
if command -v pyenv 1>/dev/null 2>&1; then
eval "$(pyenv init -)"
fi

Restart Zsh:
The Exec (e) command is used to execute the specified command that’s provided as an argument. It destroys the current process and replaces it with the specified command without creating a new process. It can also restart the shell to reload the configuration file into the environment.
- Copy the command from below these instructions
- Paste the command into Terminal
- Press “Return”
exec zsh

Create the Temporary Directory:
The Make Directory (mkdir) command is used to create new directories. It can specify one or more relative or absolute paths with the name of the new directories to be created. It can also be used with the “Parents” flag to create parent directories as needed without overwriting a path that already exists.
- Copy the command from below these instructions
- Paste the command into Terminal
- Press “Return”
mkdir temporary

Open the Temporary Directory:
The Change Directory (cd) command is used to change the current working directory to the specified directory. It can navigate to absolute and relative paths that start from the root and current working directory, respectively. It can also navigate to paths stored in variables and environment variables.
- Copy the command from below these instructions
- Paste the command into Terminal
- Press “Return”
cd temporary

Set the Default Python Version for the Directory:
The Local command is used in Pyenv to specify the default Python version for the current directory. It creates a text file in the current directory that stores the specified version. This is automatically detected by Pyenv which activates the Python version in the current directory and subdirectories.
- Copy the command from below these instructions
- Paste the command into Terminal
- Press “Return”
pyenv local 3.6.12

Check the Default Version:
The Version (V) option is used to check which version of Python is currently selected as the default version. It consists of three numbers separated by periods that represent the major, minor, and micro version number. It also displays an error message if Python isn’t already installed on the computer.
- Copy the command from below these instructions
- Paste the command into Terminal
- Press “Return”
python --version

Open the Parent Directory:
The Change Directory (cd) command is used to change the current working directory to the specified directory. It can navigate to absolute and relative paths that start from the root and current working directory, respectively. It can also navigate to paths stored in variables and environment variables.
- Copy the command from below these instructions
- Paste the command into Terminal
- Press “Return”
cd ..

Check the Default Version:
The Version (V) option is used to check which version of Python is currently selected as the default version. It consists of three numbers separated by periods that represent the major, minor, and micro version number. It also displays an error message if Python isn’t already installed on the computer.
- Copy the command from below these instructions
- Paste the command into Terminal
- Press “Return”
python --version

Open the Temporary Directory:
The Change Directory (cd) command is used to change the current working directory to the specified directory. It can navigate to absolute and relative paths that start from the root and current working directory, respectively. It can also navigate to paths stored in variables and environment variables.
- Copy the command from below these instructions
- Paste the command into Terminal
- Press “Return”
cd temporary

Create the Virtual Environment:
The Virtual Environment is an isolated Python installation directory that has its own interpreter, site-packages, and scripts. It mostly gets used to prevent version conflicts between dependencies from different projects. It also gets used to meet dependency requirements of different programs from GitHub.
- Copy the command from below these instructions
- Paste the command into Terminal
- Press “Return”
python -m venv venv36

Activate the Virtual Environment:
The Activate script is used to start the virtual environment. It prepends the virtual environment path to the PATH environment variable which sets the new Python interpreter and package manager as the default version. It also sets packages to install in the virtual environment installation directory.
- Copy the command from below these instructions
- Paste the command into Terminal
- Press “Return”
source ./venv36/bin/activate

Check the Default Version:
The Version (V) option is used to check which version of Python is currently selected as the default version. It consists of three numbers separated by periods that represent the major, minor, and micro version number. It also displays an error message if Python isn’t already installed on the computer.
- Copy the command from below these instructions
- Paste the command into Terminal
- Press “Return”
python --version

Check the Executable File:
The Which command is used to identify the location of the executable file for the specified command name. It searches for the executable file in the list of directories from the PATH environment variable. It also displays the absolute path of the executable file if it exists in the one of the directories.
- Copy the command from below these instructions
- Paste the command into Terminal
- Press “Return”
which python

Deactivate the Virtual Environment:
The Deactivate command is used to stop the virtual environment. It removes the virtual environment path from the PATH environment variable which sets the last Python interpreter and package manager as the default version. It also sets packages to install in the system Python installation directory.
- Copy the command from below these instructions
- Paste the command into Terminal
- Press “Return”
deactivate

“Hopefully, this article helped you get the 👯♀️🏆👯♀️, remember to subscribe to get more content 🏅”