logo

How To Install Python On MacOS


Show

Introduction

Python is a far above the ground level, active, general-purpose language. It was expanded by Guido Van Rossum in 1991. Python's syntax authorizes programmers to utilize smaller amount lines of code than any additional programming language. It focuses on the code readability of the plan. Python 2.7 is installed by default on macOS bar we can install other versions such as python 3.5 and 3.6.

In the respective tutorial, we are coaching how to install Python 3.6.3 on the MAC Operating system.

Prerequisites

  • macOS
  • Log in as an administrator on terminal

Installation

There are the following steps, which are used while installing Python3 on MacOS.

1) Checking python's version on the system

We could ensure which version of Python is presently installed on our system. In general, Python 2.7 is installed by default.

Let's see how can we do it.

$ python -version
Macos Python

macOS Python 1

It displays Python 2.7.10 is installed on the computer, which is rather frequently.

2) Download Python 3.6.3

Inline to install Python 3.6.3, we have to download the newest version from its bureaucrat website https://www.python.org/downloads/. The file is downloaded in .pkg format which can be directly installed by using Installer command.

3) Install Python 3.6.3

Since the downloaded file already is in .pkg format hence no mounting is required and We can use the installer command to install Python 3.6.3.

Let's see how can we do it.

Macos Python

macOS Python 2

As the installer is utilized with great user permissions, therefore, SUDO forces the terminal to punctual the user to seal the admin password. The procedure installs Python 3.6.3 to the root directory which is stated with the target alternative.

4) Verify Python3

To check which Python version is installed on the machine, we can use the python -version command. Since by default installed version is Python 2.7.10 hence it shows python 2.7.10. but it gives us the flexibility to verify the version of Python 3 on our computer.

Let's see how can we use python 3 to check which version of python 3 is running.

$ python -version

5) Working on Python's script mode

To effort on the Python command line, we merely type python3 on the terminal. Python case opens where we could run Python declarations such as print values as we did here.

Macos Python

macOS Python 3

To run a Python file (.py) on the incurable, we merely kind the file name and the file will be understood.

Well, we have installed Python3 on our macOS.

Here at Intellinuts, we have created a complete Python tutorial for Beginners to get started in Python.