Setting up Python on M2 Macbook Air
Notes on how I set up Python on my M2 Macbook Air. This is one of those posts that is more for my own records but here it is.
Prerequisites:
1. Install Command Line Developer Tools
- Open Terminal and type
- The following prompt will show up asking if you would like to install the tools now.
- After it installs type this command in the Terminal
- The response should be
Step 1: Install Homebrew
- https://brew.sh
Run these two commands in your terminal to add Homebrew to your PATH (Homebrew gives these commands to you after installation):
Check if Homebrew is installed correctly
Terminal should respond
Step 2: Install Pyenv
To update in the future use
Add three lines to your configuration file
- This line sets an environment variable (
PYENV_ROOT
) that points to the pyenv directory.
- This line puts pyenv first in your search path so that the OS will find pyenv’s Python(s) before any other Pythons.
- This line initializes pyenv each time you open a terminal.
Step 3: Install Python Versions
- https://github.com/pyenv/pyenv/blob/master/COMMANDS.md
Before installing python I want to install a couple of packages
Check which version are available
Install latest version
Rehash Python binaries
Check which versions you have downloaded
Set Global version of Python
Uninstall a version of Python