Installing Python on macOS Monterey
I got the new MacBook Pro and wanted to install python using Pyenv.
Pyenv is an open-source tool used for managing multiple python environments. It allows developers to define which version of python to use on a per-project basis.
So I followed the following steps.
Installed Homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Then run the following command to install pyenv:
Install pyenv
brew install pyenv
Once installed, I ran the following to download and compile Python 3.10.0:
Install Python 3.10.0 using pyenv
pyenv install 3.10.0
pyenv global 3.10.0
pyenv version
The last command should return something similar to the following output:
The output of the command
$ pyenv version
3.10.0 (set by /Users/russ.mckendrick/.pyenv/version)
Now that Python is installed and we have set version 3.10.0 to the default Python install used by pyenv, we need to run the following command to ensure that our preferred version is used whenever we open a new terminal session.