Getting Python 3 to run on macOS Monterey
This article is absolutely a bit more niche than what I usually write about, so sorry in advance for that.
Python 2 was deprecated a while ago, but continued to be the default on macOS for a while. After upgrading my MacBook to Monterey, I discovered that Python 2 had been removed.
I don’t code in Python, but it is my preferred way to run a web server on my Mac.
I installed Python 3, but running python
in terminal was throwing a command not found
error in Terminal.
After a bunch of Duck Duck Going, I finally found a solution on StackOverflow. I run this command in Terminal.
echo "alias python=/usr/bin/python3" >> ~/.zshrc
As I mentioned a few weeks ago I use Oh My Zsh in terminal. If you use stock terminal, the file you write to (.zshrc
in the code above) might be different for you.
But this fixed my issue, remapping the python
alias to python3
instead of python2
.