How to install Python?

Created Jan 15, 2024Last modified Jan 15, 2024
PythonLinuxmacOSWindows

Python Basics


macOS

1. Check if python is already installed:

Open the Terminal and type python3 or python. If it's installed, you'll see the Python prompt. If not, you'll be prompted to install it.

You can use Homebrew to easily install and manage software on macOS:

brew install python

Linux

1. Open Terminal:

Launch the terminal on your system.

2. Check if it is already installed:

Type python3 or python. If it's installed, you'll see the Python prompt. Otherwise, continue with the following steps.

3. Update package list:

Ubuntu

sudo apt update

CentOS and RHEL

sudo yum update
# optional but recommended
sudo yum groupinstall "Development Tools"

Fedora

sudo dnf update

Debian

sudo apt-get update

4. Install Python:

Ubuntu

sudo apt install python3

CentOS and RHEL

sudo yum install python3

Fedora

sudo dnf install python3

openSUSE

sudo zypper install python3

Arch Linux

sudo pacman -S python

Debian

sudo apt-get install python3

Windows

1. Download Python Installer:

Visit the official Python website and download the latest version of Python for Windows.

2. Run the Installer:

Run the downloaded installer. Make sure to check the box that says "Add Python to PATH" during installation.

3. Verify Installation:

Open the Command Prompt or PowerShell and type:

python --version