I had previously installed Python 3 with brew install python3 -universal, but I have been unable to upgrade from 3.4.2 to 3.4.3. Gist with log files and output. Brew doctor output (nothing unexpected): $ brew doctor Please note that the. Homebrew installs pip pointing to the Homebrew’d Python 3 for you. Working with Python 3 ¶ At this point, you have the system Python 2.7 available, potentially the Homebrew version of Python 2 installed, and the Homebrew version of Python 3 as well. For older Homebrew: For Python 2.x: brew install python For Python 3.x: brew install python3 Now, you will have both the versions installed in your machine. When you want to use version 2, use the python executable. When you want to use version 3, use the python3 executable. Solution 3: Currently Homebrew provides two different formulas for. Learn how to upgrade Python 3.6 to Python 3.7 or 3.8 on Mac OS. 1) Open up Python official download site. It looks something like the image below. Press Download Python 3.7.4 (release date was July 8, 2019) or Download Python 3.8.0 (release date was Oct. 14, 2019) or the version you would like to download. To uninstall python that was installed using homebrew you need to identify what versions of python have been installed by Homebrew: Enter: $ brew list grep 'python'. Currently brew refers to python3 as python and python 2 is called [email protected] To uninstall both python2 and python3 enter the following.
Had a slightly confusing time doing this recently, so here’s a brief explanation of how to do this and why you might want to:
Python has several versions, 2 and the newest, 3—up to 3.7 at the time of this writing. On a Mac, your system came with one built in, probably 2.7, which is not what we want to use for installing tools such as Ansible or the AWS command line interface. So let’s leave this alone.
We want the latest 3.x version and will install it with Homebrew.
Check current Python status in the terminal (these are all terminal commands!)—you can hit
tab twice after typing “python” to see all the auto-complete options of all the Python installs you may have.
This gave me a bunch of stuff. Not super helpful.
This is better. Once you have the file paths, you can then check versions like:
Installation with Homebrew
Make sure to define the version you want:
This comes with pip3, Python’s package installer/manager, which we want for Ansible, etc.
Aliases for pip and python commands
Let’s not worry about remembering to type out
python3 by aliasing them from your
Re-open the terminal and check that this worked:
Using Pip3-managed tools on the command line
You can now do things like:
(If you don’t do the aliasing, you will want to do this:)
Ansible will install itself to your PATH, but aws-cli lands in a Python folder, so we need to add that folder to our Bash profile. Note the version number in the file path.
Make sure this worked:
Now you’re good to go.
Python programming language is one of the most used programming language these days. Many Mac and even Windows users are using the programming language for various purposes. The python language has its own IDE to write programs and if you are already coding in python then you must know that python codes are saved in .py format. But many Mac users face the issue of updating python or don’t even know about the latest version of python.
So, if you are one of them and want to update or python or just install the python in your Mac device then follow the methods that I would write in this article.
- 2 How to Install/Update python on Mac?
How to check the python version?
Install Python 3.5.2
To check which version of Python you have installed in your Macbook, you need to type a single line code in your terminal. So, let me guide you on you can do that:
- Open the Terminal on your Mac.
- Now, enter the command
python --versionand press the Enter key.
- You can see the result in the next line itself, displaying the version of python installed on your Mac pc.
But, if that command doesn’t work for you then you may try
python3 --version and then press the Enter key. If this command works then you already have the python version 3 installed. But still, if you have a version lower then 37.4 then you can follow the methods below and get the latest version installed.
Mac Brew Install Python3.8
How to Install/Update python on Mac?
So, there are various methods using which python can be installed and not updated. I will tell you why not updated, because there are many apps in Mac still running on python 2 and not Python 3. Also, installing python 3 won’t remove python 2 and all your apps would work fine with it. That’s why you can follow the below methods to install python 3.
1. Using Python.org
- Download the latest version of python from this link.
- Click on the Latest Python 3 Release to start the download.
- Open the file and click on Continue to start the install.
- And done, python is installed successfully.
The latest version of python is installed in your Mac and now you can use it for whatever programming needs you have.
2. Using HomeBrew & XCode
The HomeBrew is a package manager required in Mac or other Linux based OS to install other applications on Mac. So, we will be using HomeBrew to install the latest version of python on your Mac pc but you need to have installed HomeBrew on your Mac already. If you do not have it installed then you would have to follow the method below to install HomeBrew first, we will be installing HomeBrew using XCode. So, let’s begin with installing XCode first and then HomeBrew using the below mentioned commands:
- Open the terminal on your Mac pc.
- Now, type the command
xcode-select --installand press the Enter key.
- Wait till the system installs the XCode and press Install if asked.
- Now, it is time to install HomeBrew and to do so, just copy and paste the following command
/usr/bin/ruby -e '$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)'and press Enter.
- This will install HomeBrew on your system.
- To confirm the installation, you can check by entering the command
brew doctorand press Enter.
- If you see the result of the above command a
Your system is ready to brew.then you have installed HomeBrew successfully.
- Now, you are ready to install python3 on your Mac.
- It is easy to install python3 on Mac using HomeBrew, just enter the command
$ brew install python3and wait till the installation is complete.
So, you have successfully installed XCode, HomeBrew & Python3 finally and now you can use python for all your programming needs. Also, if you have an interest in making apps for iOS then you may use XCode for that.
Since python3 is installed already on your Mac, though if you feel like checking and confirming the installation or check the version then you may refer the How to check the python version? section above. Or just simply enter the command
$ python3 --version in the terminal and you would know.
How to run Python with Python3?
Now, if you have previously installed the older version of python like python2 and now you have installed python3 using this article, let me tell you that you can run both the python on your Mac device now. So, previously while running or opening python2 you might have to enter a command. The same command would help you with running python3 too.
- Open the terminal, type python and press the Enter key.
- This command would open the python2 installed on your Mac and also show you the version of python installed.
- You can write programs or python commands if you want to. Else you can type exit() and press the Enter key to close the python2.
- Similarly, type python3 and press the Enter key.
- This would open the latest version of python3 installed on your Mac. Again you can exit python3 using the exit() command.
Mac Brew Install Python 3 6
Python is one of the newest and growing programming language used in many fields for various applications. Likewise, it is used on Mac for various applications and the latest version of python launched for Mac till date is python 3 or python version 3.7.4. The article shares with you 2 methods to update python on Mac to its latest version. Also, it teaches you about a command that can help you check the version of python installed. I hope all of this helps you with installing the latest version of python. Though, if you have any queries don’t hesitate to ask it by commenting below.