THE FOUNDER’S GUIDE:

How to Install and Manage Multiple Python Versions on Mac

The condensed tutorial with copy and paste code and screenshots

David Littlefield
6 min readFeb 11, 2021
Image by Isabella and Louisa Fischer

“The expanded version of this article uses concise explanations to help you learn what’s happening 💡”

Open Terminal:

  1. Press “Command ⌘ + Spacebar”
  2. Enter “Terminal”
  3. Press “Return”

Check the Default Version:

  1. Copy the command from below these instructions
  2. Paste the command into Terminal
  3. Press “Return”
python --version

Check the Executable File:

  1. Copy the command from below these instructions
  2. Paste the command into Terminal
  3. Press “Return”
which python

Install Homebrew:

  1. Copy the command from below these instructions
  2. Paste the command into Terminal
  3. Press “Return”
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Install Pyenv:

  1. Copy the command from below these instructions
  2. Paste the command into Terminal
  3. Press “Return”
brew install pyenv

Install the Pyenv Dependencies:

  1. Copy the command from below these instructions
  2. Paste the command into PowerShell
  3. Press “Enter”
brew install openssl readline sqlite3 xz zlib

View the Python Versions:

  1. Copy the command from below these instructions
  2. Paste the command into Terminal
  3. Press “Return”
pyenv install --list

Install Python:

  1. Find the version from below these instructions
  2. Copy the provided command
  3. Paste the command into Terminal
  4. Press “Return”
  5. Repeat
Python 3.5:
pyenv install 3.5.4
Python 3.6:
pyenv install 3.6.8
Python 3.7:
pyenv install 3.7.9
Python 3.8:
pyenv install 3.8.6
Python 3.9:
pyenv install 3.9.0

Set the Default Version for the Computer:

  1. Copy the command from below these instructions
  2. Paste the command into Terminal
  3. Press “Return”
pyenv global 3.8.6

Open the Home Directory:

  1. Copy the command from below these instructions
  2. Paste the command into Terminal
  3. Press “Return”
cd ~

Create the Zsh Configuration File:

  1. Copy the command from below these instructions
  2. Paste the command into Terminal
  3. Press “Return”
echo "" >> .zshrc

Open the Zsh Configuration File:

  1. Copy the command from below these instructions
  2. Paste the command into Terminal
  3. Press “Return”
open -a textedit ~/.zshrc

Edit the Zsh Configuration File:

  1. Copy the code from below these instructions
  2. Paste the code into TextEdit
  3. Click the “File” menu
  4. Click “Save”
# Pyenv initialization
if command -v pyenv 1>/dev/null 2>&1; then
eval "$(pyenv init -)"
fi

Restart Zsh:

  1. Copy the command from below these instructions
  2. Paste the command into Terminal
  3. Press “Return”
exec zsh

Create the Temporary Directory:

  1. Copy the command from below these instructions
  2. Paste the command into Terminal
  3. Press “Return”
mkdir temporary

Open the Temporary Directory:

  1. Copy the command from below these instructions
  2. Paste the command into Terminal
  3. Press “Return”
cd temporary

Set the Default Version for the Directory:

  1. Copy the command from below these instructions
  2. Paste the command into Terminal
  3. Press “Return”
pyenv local 3.6.8

Check the Default Version:

  1. Copy the command from below these instructions
  2. Paste the command into Terminal
  3. Press “Return”
python --version

Open the Parent Directory:

  1. Copy the command from below these instructions
  2. Paste the command into Terminal
  3. Press “Return”
cd ..

Check the Default Version:

  1. Copy the command from below these instructions
  2. Paste the command into Terminal
  3. Press “Return”
python --version

Open the Temporary Directory:

  1. Copy the command from below these instructions
  2. Paste the command into Terminal
  3. Press “Return”
cd temporary

Create the Virtual Environment:

  1. Copy the command from below these instructions
  2. Paste the command into Terminal
  3. Press “Return”
python -m venv venv36

Activate the Virtual Environment:

  1. Copy the command from below these instructions
  2. Paste the command into Terminal
  3. Press “Return”
source ./venv36/bin/activate

Check the Default Version:

  1. Copy the command from below these instructions
  2. Paste the command into Terminal
  3. Press “Return”
python --version

Check the Executable File:

  1. Copy the command from below these instructions
  2. Paste the command into Terminal
  3. Press “Return”
which python

Deactivate the Virtual Environment:

  1. Copy the command from below these instructions
  2. Paste the command into Terminal
  3. Press “Return”
deactivate

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

Next Steps:

This article is part of a mini-series that helps readers set up everything they need to start learning about artificial intelligence, machine learning, deep learning, and or data science. It includes articles that contain instructions with copy and paste code and screenshots to help readers get the outcome as soon as possible. It also includes articles that contain instructions with explanations and screenshots to help readers learn about what’s happening.

Linux:
01. Install and Manage Multiple Python Versions
02. Install the NVIDIA CUDA Driver, Toolkit, cuDNN, and TensorRT
03. Install the Jupyter Notebook Server
04. Install Virtual Environments in Jupyter Notebook
05. Install the Python Environment for AI and Machine Learning
WSL2:
01. Install Windows Subsystem for Linux 2
02. Install and Manage Multiple Python Versions
03. Install the NVIDIA CUDA Driver, Toolkit, cuDNN, and TensorRT
04. Install the Jupyter Notebook Server
05. Install Virtual Environments in Jupyter Notebook
06. Install the Python Environment for AI and Machine Learning
Windows 10:
01. Install and Manage Multiple Python Versions
02. Install the NVIDIA CUDA Driver, Toolkit, cuDNN, and TensorRT
03. Install the Jupyter Notebook Server
04. Install Virtual Environments in Jupyter Notebook
05. Install the Python Environment for AI and Machine Learning
Mac:
01. Install and Manage Multiple Python Versions
02. Install the Jupyter Notebook Server
03. Install Virtual Environments in Jupyter Notebook
04. Install the Python Environment for AI and Machine Learning

--

--

David Littlefield
David Littlefield

Written by David Littlefield

From: Non-Technical | To: Technical Founder | Writes: To Make It Easier For Everyone | Topics: #Startups #How-To #Coding #AI #Machine Learning #Deep Learning

No responses yet