How to install Python on Windows, Mac, and Linux?

First published: | Last updated:

Learn how to download and install the Python interpreter on Windows, Mac, and Linux operating systems.


What is Python?

Python is a versatile, interpreted, object-oriented, high-level programming language with dynamic semantics. It offers high-level built-in data structures and utilizes dynamic typing and dynamic binding, making it extremely appealing for quick application development. Additionally, it is often used as a scripting or glue language to connect different existing components.

Install Python

This knowledge base article provides a comprehensive guide on how to install Python on various operating systems, including Windows, Mac, and Linux. It includes detailed, step-by-step instructions tailored for each platform to ensure a smooth installation process. Once you’ve successfully installed Python, it’s crucial to check the installed version. This verification step helps confirm that the installation was completed without any issues, allowing you to start using Python with confidence. For further information and detailed instructions, please refer to the official Python documentation.

Windows

  1. Download the Python installer.
  2. Execute the Python installer, and proceed with Next and Finish prompts to install Python.

After installing Python on your Windows operating system, you’ll want to verify the installation by using the following commands.

# Check Python version.
$ python --version

Mac

  1. Download the Python package.
  2. Execute the Python package, and proceed with Continue and Install prompts to install Python.

After installing Python on your Mac operating system, you’ll want to verify the installation by using the following commands.

# Check Python version.
$ python --version

Linux (RPM)

You can use the following commands to install Python in RPM-based Linux operating systems such as CentOS LinuxRed Hat LinuxFedora LinuxAmazon LinuxAlma LinuxRocky Linux, etc., or any other similar equivalents.

# Install Python.
$ sudo yum install python3.12

# Set Python 3.12 as default interpreter and Python 3.9 as fallback interpreter.
$ sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.9 1
$ sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.12 2

# List Python versions.
$ sudo update-alternatives --list python

# Check Python version.
$ python --version

Linux (Debian)

You can use the following commands to install Python in Debian-based Linux operating systems such as Ubuntu LinuxMint LinuxKali LinuxKubuntu Linux, etc., or any other similar equivalents.

# Install Python.
$ sudo apt install python3.12

# Set Python 3.12 as default interpreter.
$ sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.12 1

# List Python versions.
$ sudo update-alternatives --list python

# Check Python version.
$ python --version
Logo of SloopStash organization.

What's next? Let's connect to meet your IT demands.

Products Toolkits Solutions Training


Experience business-class software products, open source toolkits, technology solutions, and training, designed with cybersecurity, automation, and AI in mind.