Python is among the most widely used programming language by developers. If you own MacBook or iMac and looking for the ways to update Python on your Mac device? you are on the right blog post. Though updating Python on Mac seems to be a tiresome process, we have compiled a couple of easy ways to upgrade Python on Mac device. This blog article also covers how to install the latest version of Python 3 or Python 2 on Mac.
So with no further ado, let’s get straight to the topic and know about “How to Update Python on Mac?”
Updating Python on Mac:
Recent versions of MacOS are compatible with and support Python 2.7.x while Python 2.6.1 in case of the older versions. However for some reasons loads of users require to upgrade to Python 3.6 or 3.7. If that is also a must needed in your case, you must know the ways to update Python on Mac.
Well, here are the simple methods to Update Python on your Mac.
Method#1: Update Python on Mac using the Python Installer
By far, the easiest way to install or update to the latest version of Python on Mac is by using Python’s official website and then keeping a track of future updates by going through the site time and again yourself.
There’s also an alternative way to install or update Python without using the terminal on Mac is using the Python Installer. You can easily download the Python installer from its official website python.org using the steps given below:
- Navigate to Python.org and then download the most recent Python 3 installer file.
- Once it is downloaded, run the set up file to install Python 3.x on your device.
- After completing the installation for Python, you will get to see the Python3 folder and IDLE in the /Applications on your Mac.
Having installed the Python Installer you can now easily update Python on Mac using a single command. However previous to updating or installing Python on Mac using the Python installer, you should look for the currently installed version of Python on Mac. This can be done by following the process mentioned below:
How to Know the Installed Version of Python
You can get to know about the versions of Python 2 and Python 3 installed on Mac using the commands provided below:
For Python 2: “python –version”
For Python 3: “python3 –version”
Note: It is to be noted that there is no need to remove Python 2.x or update it from 2.x to 3 for MacOS.
Once you have checked for the installed version, you can now see if any new version is available for installation or update on the official website. And if it does, then you can install and/or update the preferred version of Python on Mac using the Python Installer.
You can also ensure that whether the new version of Python is installed and/or updated successfully by checking the respective Python version using the above two commands.
Mthod#2: Update Python on Mac with Homebrew
Another method to update Python to the latest version on MacOS is using Homebrew, open-source package manager software meant for MacOS and Linux.
Homebrew helps you in both the processes i.e.; installation of the Python software as well as updating the same through the terminal.
In case Homebrew is not installed on your Mac, ahead of going on for installation of Python with Homebrew, you need to get it downloaded and installed on your MacBook. This can be done by visiting the official website of Homebrew or clicking here. Homebrew gets install to the default location as /user/local.
Now, to install Python using HomeBrew, you need to follow the steps provided underneath:
- Run the below mentioned command in Terminal:
brew install python3
- After Python 3 is installed on your Mac device, you can set is as default application to run the programs, by using the command as:
cp /usr/local/bin/python3 /usr/local/bin/python
- You can also update the version of Python 3 from 3.x to 3.y with the help of following command on the terminal.
brew update && brew upgrade python
This way you can get Python 3 installed and updated on your Mac, now start programming with Python3 on your Mac.
That’s all. You have successfully learn these ways to upgrade Python and perhaps these are the most easy and simple methods to Update Python on Mac?”