How to Install Python3 on MacOS

In this tutorial, we are learning how to install Python 3.6.3 on the MAC Operating system. Follow the steps which are used while installing Python.
2 min read

How to Install Python3 on MacOS

Introduction

Python is a high level, dynamic, general purpose language. It was developed by Guido Van Rossum in 1991. Python's syntax allows developers to use fewer lines of code than any other programming language. It basically focuses on the code readability of program. Python 2.7 is installed by default on MacOS but we can install other versions like python 3.5 and 3.6.

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

Prerequisites

  • MacOS
  • Login as an administrator on terminal

Installation

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

1) Checking python's version on the system

We can check which version of the Python is currently installed on our system. Generally, Python 2.7 is installed by default.

Let's see how can we do it.

  1. $ python -version    
Macos Python 1

It shows Python 2.7.10 is installed on the computer which is quite often.

2) Download Python 3.6.3

In order to install Python 3.6.3, we must download the latest version from its official 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 installer command to install Python 3.6.3.

Let's see how can we do it.

Macos Python 2

Since The installer is used with super user permissions hence sudo forces terminal to prompt the user to fill the admin password. The process installs the Python 3.6.3 to the root directory which is mentioned with the target option.

4) Verify Python3

To check which Python version is installed on the machine, we can use python -version command. Since by default installed version is Python 2.7.10 hence it shows python 2.7.10. but it gives us flexibility to check 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.

  1. $ python -version   

5) Working on Python's script mode

To work on Python command line, we simply type python3 on the terminal. Python shell open where we can run Python statements such as print statements as we did here.

Macos Python 3

To run a Python file (.py) on the terminal, we simply type the file name and the file will be interpreted.

Well, we have installed Python3 on our MacOS.

Installation on Windows

To install python3 on Windows OS , visit the link https://coderpad.blogspot.com/2022/11/how-to-install-python-on-windows.html and follow the instructions given in the tutorial.

Installation on CentOS

To install Python3 on CentOS, visit the link https://coderpad.blogspot.com/2022/11/how-to-install-python-3-on-centos.html and follow the instructions given in the tutorial.

Installation on Ubuntu

To install Python3 on Ubuntu, visit the link https://coderpad.blogspot.com/2022/11/how-to-install-python-on-ubuntu-2004-lts.html and follow the instructions given in the tutorial.

 

Men' fashion , Dating Tips , Relationship Advice

You may like these posts

  • How to Read files in Python? To read a file in Python, you can use the built-in open() function to open the file, and then use the .read() method to read its contents. For exa…
  • How to install Python on Ubuntu 20.04 LTS? Introduction Python is a high level, dynamic and general purpose programming language. It was designed and developed by Python Software…
  • How to Install Python3 on MacOS Introduction Python is a high level, dynamic, general purpose language. It was developed by Guido Van Rossum in 1991. Python's syntax allows deve…
  • How to Install Python 3 on CentOS Introduction Python is a high level, dynamic, general purpose language. It was developed by Guido Van Rossum in 1991. Python's syntax allows dev…
  • In the previous tutorial on Basic Data Types in Python, you saw how values of various Python data types can be created. But so far, all the values shown have been literal or c…
  •  How to Install Python (Environment Set-up) In order to become Python developer, the first step is to learn how to install or update Python on a local machine or computer. I…

Post a Comment