Update Python 3 Mac Terminal



Python is a programming language that’s widely used by both beginners and professional developers. This brief guide is written because many people search hot to Update Python on MAC computers. So we will show you how to install Python 3 on a Mac OS X computer.

The official home of the Python Programming Language. While Javascript is not essential for this website, your interaction with the content will be limited. I had the same problem, I did the following instruction to resolve it: After installing Python3.6. To make python3 use the new installed Python 3.6 instead of the default 3.5 release, run following 2 commands. Sudo update-alternatives -install /usr/bin/python3 python3 /usr/bin/python3.5 1 sudo update-alternatives -install /usr/bin/python3 python3 /usr/bin/python3.6 2.

Before you jump in the manual, do take note that there are a number of ways to install Python 3 on a Mac but with this guide, I’ll show you the two easiest ways to do so. Personally, the way I did it was using a package manager like HomeBrew (it is okay if you do not know what it is). Again, I’ll show you how you can do this method down below. I will explain how to install the Python 3 upgrade on a Mac.

Some Mac programs require Python 2, and when updating they may start to malfunction or stop working. Therefore, we won’t update the version, but install Python 3 in parallel. Python 3 and Python 2 can coexist without conflicts on the Mac the commands will differ slightly. For it could be somewhat frustrating that Apple does not supply the latest version, typically used these days, when learning Python.

Update Python MAC

How to install Python 3 in macOS with Installer

Mac

The easiest way is to download the Python installer from the python.org website.

  • Visit Python.org and download the latest available Python installer file;
  • Run the downloaded file and install Python 3.x on Mac.
  • Python 3.6.x requires about 100MB of available disk space. The installation process is very fast;
  • When Python 3 is installed, you will see the Python3 folder in /Applications on your Mac. You will also see IDLE in the /Applications.

The Python installation may require about 100MB of disk space to install. Once you’ve installed Python 3 you can have it alongside Python 2 without having to delete the latter from your Mac.

Next method will show you how to install Python 3.x on a Mac through Homebrew.

How to install Python 3 using Homebrew

Installing an updated version of Python 3 through Homebrew is extremely simple. Of course, Homebrew should be installed on your computer, however, if you are interested in this method, then you probably have already used the program more than once.

First of all, you’ll need to have this thing called HomeBrew installed on your Mac. Homebrew is basically a “package manager”. A package manager is an application that helps you install the stuff you need that Apple (or even your Linux System) hadn’t installed in the first place for you.

It’s simple, fast and safe.

Second, you will need to have installed XCode onto your Mac. If you’re thinking of learning how to program or creating iOS apps on your Mac, then it’s good to have XCode installed. We will be using XCode to install HomeBrew application.

Note

If you have already installed XCode onto your Mac you can skip step 1 and jump straight to step 3.

Here are the steps to install XCode, HomeBrew as well as install Python 3 using HomeBrew onto your Mac:

  1. Jump into your Terminal app on your Mac and run the copy/paste the following command into the Terminal to install XCode onto your Mac:
  2. Simply click through all the confirmation crap that XCode shows. It may take a little while to install XCode since it is a large program.
  3. Great! Now that you have XCode installed, you can install HomeBrew! To install HomeBrew, simply copy/paste the following command into your Terminal:

Note

You can confirm the HomeBrew installed correctly by running the command: below:

  1. You’ve installed HomeBrew! Now let’s install the Python 3, the reason why you’re here. To install the latest version of Python, just copy/paste the following command into your Terminal:

Note

You can confirm which version of Python was installed all by running the command below (the exact same command you tried earlier in this guide). It should show up as follows:

  1. Finally, let’s run our new Python 3. Simply enter python3.

How to Find out the Installed Version of Python

Open the Terminal program and use the following command:

In most cases, Python 2.7.x will be installed on macOS: either 2.7.4 or 2.7.10.

Update Python 3 Mac Terminal

If you installed the Python update, you can check the version with the following command:

Once again, both versions of Python can coexist without conflicts.

Note: Once again, I want to remind you that you do not need to upgrade Python 2.x to Python 3.x, because this can lead to program malfunctions. Just install the updated version in parallel.

Check out the steps below to install Python 3 on Mac OSX.

How to download Python3

You can download Python 3 by downloading from official Python website or using Homebrew package manager for macOS .

Python Official Site

1) Open up Python official download site. It looks something like the image below. Press Download Python 3.7.4 or the version you would like to download.

2) After downloading the installer, open it to install Python 3.

Python 3.7.4 installer Read Me contains the following note about Python 3 and Python 2 Co-existence. Thus, to run Python 3, you can run Python3 or Python3.X.X (a specific version that you installed on your machine). To run Python 2, you can run Python or Python2.7.

3) Remove Python installer when you are done installing

4) Run python3 --version to check if Python 3 is installed.

Install Python 3 Terminal

If you install Python 3.7.X, you can also check its version using this command:

Update python 3 mac terminal 1

Homebrew

Another way to install Python 3 on Mac OS is using Homebrew package manager.

Python

1) If you don’t have Homebrew install, you can install Homebrew by following the steps on Homebrew site. You can also use the following command to install Homebrew by copy and pasting it onto your terminal.

2) To install the latest version of Python 3, run the command below.

If you already have the latest Python installed, you will see something like the message below.

Terminal

3) Run python3 --version to check if Python 3 is installed.

If you install Python 3.7.X, you can also check its version using this command:

Python 3 Shell

To open Python 3 shell from terminal, you can run Python 3.

To close Python shell, you can type in exit(). The hotkeys to close it is to press Ctrl and D simultaneously.
Note that Command and D splits your Python shell view.

Note that you can still access Python 2 by running python command.

Python 3 Package Manager Pip3

Python 3 comes with its own package manager pip3. You can check out Python Package Index to look for packages that you need.

To install a package using pip, you can run pip3 install package_name.

Switch between Python 3 Versions

Python Official Site

The easier way is to download multiple versions from Python official website and run Python command with a version appeneded such as python3.7 and python3.6.

Homebrew

If you have previous versions of Python installed, you can run the following commands to check what versions you have and switch the version you need.

Python 3 Mac Terminal

Support Jun

Update Python Version On Mac

Thank you for reading!

If you are preparing for Software Engineer interviews, I suggest Elements of Programming Interviews in Java for algorithm practice. Good luck!

You can also support me by following me on Medium or Twitter.

Feel free to contact me if you have any questions.