THE FOUNDER’S GUIDE:
How to Install and Manage Multiple Python Versions on Mac
The condensed tutorial with copy and paste code and screenshots
“The expanded version of this article uses concise explanations to help you learn what’s happening 💡”
Open Terminal:
- Press “Command ⌘ + Spacebar”
- Enter “Terminal”
- Press “Return”
Check the Default Version:
- Copy the command from below these instructions
- Paste the command into Terminal
- Press “Return”
python --version
Check the Executable File:
- Copy the command from below these instructions
- Paste the command into Terminal
- Press “Return”
which python
Install Homebrew:
- 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:
- Copy the command from below these instructions
- Paste the command into Terminal
- Press “Return”
brew install pyenv
Install the Pyenv Dependencies:
- Copy the command from below these instructions
- Paste the command into PowerShell
- Press “Enter”
brew install openssl readline sqlite3 xz zlib
View the Python Versions:
- Copy the command from below these instructions
- Paste the command into Terminal
- Press “Return”
pyenv install --list
Install Python:
- Find the version from below these instructions
- Copy the provided command
- Paste the command into Terminal
- Press “Return”
- Repeat
Python 3.5:
pyenv install 3.5.4Python 3.6:
pyenv install 3.6.8Python 3.7:
pyenv install 3.7.9Python 3.8:
pyenv install 3.8.6Python 3.9:
pyenv install 3.9.0
Set the Default Version for the Computer:
- Copy the command from below these instructions
- Paste the command into Terminal
- Press “Return”
pyenv global 3.8.6
Open the Home Directory:
- Copy the command from below these instructions
- Paste the command into Terminal
- Press “Return”
cd ~
Create the Zsh Configuration File:
- Copy the command from below these instructions
- Paste the command into Terminal
- Press “Return”
echo "" >> .zshrc
Open the Zsh Configuration File:
- Copy the command from below these instructions
- Paste the command into Terminal
- Press “Return”
open -a textedit ~/.zshrc
Edit the Zsh Configuration File:
- 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:
- Copy the command from below these instructions
- Paste the command into Terminal
- Press “Return”
exec zsh
Create the Temporary Directory:
- Copy the command from below these instructions
- Paste the command into Terminal
- Press “Return”
mkdir temporary
Open the Temporary Directory:
- Copy the command from below these instructions
- Paste the command into Terminal
- Press “Return”
cd temporary
Set the Default Version for the Directory:
- Copy the command from below these instructions
- Paste the command into Terminal
- Press “Return”
pyenv local 3.6.8
Check the Default Version:
- Copy the command from below these instructions
- Paste the command into Terminal
- Press “Return”
python --version
Open the Parent Directory:
- Copy the command from below these instructions
- Paste the command into Terminal
- Press “Return”
cd ..
Check the Default Version:
- Copy the command from below these instructions
- Paste the command into Terminal
- Press “Return”
python --version
Open the Temporary Directory:
- Copy the command from below these instructions
- Paste the command into Terminal
- Press “Return”
cd temporary
Create the Virtual Environment:
- Copy the command from below these instructions
- Paste the command into Terminal
- Press “Return”
python -m venv venv36
Activate the Virtual Environment:
- Copy the command from below these instructions
- Paste the command into Terminal
- Press “Return”
source ./venv36/bin/activate
Check the Default Version:
- Copy the command from below these instructions
- Paste the command into Terminal
- Press “Return”
python --version
Check the Executable File:
- Copy the command from below these instructions
- Paste the command into Terminal
- Press “Return”
which python
Deactivate the Virtual Environment:
- 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 🏅”
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 LearningWSL2:
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 LearningWindows 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 LearningMac:
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