How to make Python 3 the Default on MacOS
Despite the fact that Python is still a popular programming language, Apple has decided not to include it with MacOS.
Thank you for reading this post, don't forget to subscribe!
If you’re one that frequently uses it, then you may want to know how to make it the default in MacOS.
Here’s how:
- Open Terminal (Finder > Utilities).
- To make this easy, we’re gonna use nano for the editor. Go ahead and open it, like this:
nano ~/.zshrc
- Add the following to the bottom of the file:
alias python=/usr/local/bin/python3
- Hit [Control+O] and then [Control+X] to save the edit and then exit out of nano.
- Now you need to verify that the changes have been made.
- At the prompt, type: python –version
- Remember this is only an alias.
- If you continue to have the original Python 2.7.x release installed on the Mac, it remains accessible and usable by specifying the full path, like so: /usr/bin/python
- That’s it.
For those who don’t know, Apple has been wanting to get rid of Python for a while, and the company has taken this time to do so, as described below:
Deprecations
Python 2.7 was removed from macOS in this update. Developers should use Python 3 or an alternative language instead. (39795874)
About Post Author
(Visited 127 times, 1 visits today)