As discussed in the previous article How To Install Python 3.12 On Windows, the overall process of installing Python on macOS is not significantly different from installing it on Windows.

However, in this tutorial, i will guide you to install Python 3.12.2 on a Mac quickly and easily.

You need the following 2 prerequisites to start using Python:

  1. Python 3.12.2
  2. Integrated Development Environment (IDE) atau text editor

Let’s get started!

Download Python 3.12.2

Go to python.org/downloads and download the latest version of Python by click the Download Python 3.12.2 button.

Install Python 3.12.2

alias python='python3'
alias pip='pip3'
alias python='python3'
alias pip='pip3'

Integrated Development Environment (IDE) atau Text Editor

An Integrated Development Environment (IDE) is where we write our Python code to be executed. It’s commonly referred to as a text editor.

There are many text editor applications available nowadays. However, in this tutorial, we will try using one of the most popular text editors used, which are PyCharm and Visual Studio Code.

Let’s start with installing PyCharm and then Visual Studio Code.

Install PyCharm

  • Install by double-click the PyCharm file.
  • Drag and drop the PyCharm CE icon into the Applications folder. Wait for the file copying process to complete.
  • Open the PyCharm application. You will see the PyCharm user agreement. Just check “I confirm …” and then click Continue.
  • To start learning Python, click New Project
  • In the Name section, you can write the name of your project. Make sure in the Python version section you choose the Python 3.12 version installed on your Mac earlier. Then click Create.
  • Once the file indexing process in your project is complete, you can start creating your Python file by right-click on the folder named after your project in the left sidebar of PyCharm. Choose New, then click Python file.
  • Write the name of your Python file. For example, app.py.
  • Try to write a simple Python code, for example, print("Easy Learn Python").
  • On the top right, you will find a triangle button indicating the button to run your Python program. Just click the button.
  • You can see the output of your simple Python code in the terminal at the bottom of PyCharm.

Install Visual Studio Code Untuk Python 3.12.2

If you want to use the Visual Studio Code text editor, you can skip the PyCharm installation steps above and follow the Visual Studio Code installation steps below:

  • Install by double-click your Visual Studio Code file.
  • Once done, open the Visual Studio Code. Go to Extensions in the left sidebar menu of Visual Studio Code. Then type “python” and click install the python extension as shown in the image below.
  • Now go back to the Explorer menu on the left sidebar menu. You will see information about the Python version you are using to run your current Python program in Visual Studio Code at the bottom right. Just click on the Python version.
  • You will see several Python versions if you have installed Python before. Please choose Python 3.12.2, then your Visual Studio Code will be using the latest Python version currently as the interpreter to run your Python program.
  • To start make a Python code, you can create a Python file first by click New File icon in the Explorer on the left side of your Visual Studio Code.
  • Name it app.py and write a simple Python code, for example, print("Easy Learn Python").
  • On the top right, you will find a triangle button indicating the button to run your Python program. Click the button or click Run Code.
  • You can see the output Easy Learn Python from your simple Python code in the terminal at the bottom of Visual Studio Code.

Congratulations, you have successfully installed Python 3.12.2 and a text editor for Python like PyCharm or Visual Studio Code. Now you are ready to learn Python 3, and next, we will learn to create our first Python program.

Categorized in:

Beginner, Mac, Python,

Last Update: April 3, 2024

Tagged in:

, , , ,