Installing Python on MacBook

Installing latest python

brew install python

Upgrading after install in the next time

brew update && brew upgrade python

Aliasing to defaults

echo "alias python=/opt/homebrew/bin/python3" >> ~/.zshrc

echo "alias pip=/opt/homebrew/bin/pip3" >> ~/.zshrc

Checking installed versions

pip -V

pip 22.2.2 from /opt/homebrew/lib/python3.10/site-packages/pip (python 3.10)

python --version

Python 3.10.6

Project setup

Creating a virtual environment

python3 -m venv .venv

Activating virtual environment

source .venv/bin/activate

Deactivating virtual environment

deactivate

Useful resources:

https://opensource.com/article/19/5/python-3-default-mac