Kahibaro
Discord Login Register

Installing Python (Windows / macOS / Linux)

Before You Install

To write and run Python programs on your computer, you first need the Python interpreter installed. The steps are slightly different depending on whether you use Windows, macOS, or Linux.

This chapter focuses only on:

We’ll use the official CPython distribution from https://www.python.org.


Step 1: Check if Python Is Already Installed

You might already have Python on your system. Let’s quickly check.

On Windows

  1. Open Command Prompt:
    • Press Win key, type cmd, press Enter.
  2. In the black window, type:
text
   python --version

and press Enter.

  1. Possible results:
    • If you see something like:
text
     Python 3.12.1

then Python 3 is installed.

text
     'python' is not recognized as an internal or external command...

then Python is not installed or not on your PATH.

Also try:

text
py --version

Some Windows installations use py as the Python launcher.

On macOS

  1. Open Terminal:
    • Press Cmd + Space, type Terminal, press Enter.
  2. Type:
bash
   python3 --version

and press Enter.

  1. If you see:
text
   Python 3.x.x

then Python 3 is installed.

If it says command not found or only shows Python 2 (e.g. Python 2.7.x for python), you still need to install a recent Python 3.

On Linux

  1. Open your terminal.
  2. Type:
bash
   python3 --version

and press Enter.

Step 2: Downloading Python (All Systems)

  1. Go to the official site:
    • Open a browser and visit:
      https://www.python.org/downloads/
  2. The site usually detects your operating system and shows a big button such as:
    • “Download Python 3.x.x”
  3. Make sure the version number starts with 3 (e.g. 3.12.1), not 2.

You’ll now follow the steps specific to your operating system.


Installing Python on Windows

1. Run the Installer

  1. Download the Windows installer (usually a .exe file).
  2. Double-click the downloaded file to start the installer.

You’ll see a window titled something like “Install Python 3.x.x”.

2. Important Options on the First Screen

Look carefully at the first installer screen:

Check this box.
This makes it possible to run Python from the Command Prompt without extra setup.

Next, for beginners, click:

You do not need “Customize installation” for basic use.

3. Allow Changes and Wait

When it finishes, you should see a “Setup was successful” message.

4. Verify the Installation

  1. Open Command Prompt again.
  2. Type:
text
   python --version

or

text
   py --version
  1. You should now see something like:
text
   Python 3.12.1

If this works, Python is correctly installed and available from the command line.

5. Optional: Check IDLE and Start Menu Entries

After installation, you should find:

These confirm that the installer set up shortcuts correctly.


Installing Python on macOS

You have two common options:

We’ll focus on the official installer.

1. Run the Official Installer

  1. From https://www.python.org/downloads/, download the macOS installer (.pkg file).
  2. Open the downloaded .pkg file.
  3. A standard macOS installer window opens.

2. Go Through the Installer Steps

Wait for the installation to complete. You should see a “The installation was successful” message.

3. Verify the Installation in Terminal

  1. Open Terminal (Cmd + Space, type Terminal).
  2. Type:
bash
   python3 --version
  1. You should see:
text
   Python 3.x.x

If that works, Python 3 is installed.

On macOS, you’ll usually use python3 and pip3 instead of python and pip.

4. Check the Installed Applications

The official installer usually adds:

You can open IDLE from there if you want a simple place to type Python code.


Installing Python on Linux

Many Linux distributions already include Python 3, but sometimes it’s an older version. The way you install or update Python depends on your distribution.

Below are common instructions for major families. Always use python3 (not python) when in doubt.

1. Check Existing Python 3

In your terminal:

bash
python3 --version

2. Debian / Ubuntu / Linux Mint (APT)

Use the apt package manager.

First, update package information:

bash
sudo apt update

Then install Python 3 (and often pip):

bash
sudo apt install python3 python3-pip

Verify:

bash
python3 --version

3. Fedora (DNF)

Use the dnf package manager:

bash
sudo dnf install python3

Verify:

bash
python3 --version

4. openSUSE (Zypper)

Use zypper:

bash
sudo zypper install python3

Verify:

bash
python3 --version

5. Arch / Manjaro (pacman)

Arch-based systems often have up-to-date Python in the repos:

bash
sudo pacman -S python

Verify:

bash
python --version

On some Arch systems, python already points to Python 3.

6. Using the Official Python Installer on Linux

Advanced users may choose to compile Python from source downloaded from python.org, but for beginners, using your distribution’s package manager is usually easier and less error-prone.


Common Installation Issues and Quick Checks

“Command Not Found” or “Not Recognized”

If you see errors like:

text
  'python' is not recognized as an internal or external command...
text
  command not found: python3

Check:

On Windows, if you forgot the PATH option, you can:

Multiple Python Versions

You might have both Python 2 and Python 3 installed.

Always explicitly use:

bash
python3

in this course unless instructions say otherwise.


Final Verification Checklist

After following the steps for your operating system, you should be able to:

  1. Open a terminal or command prompt.
  2. Type one of these (depending on your OS):
    • Windows:
text
     python --version

or

text
     py --version
bash
     python3 --version
  1. See a response like:
text
   Python 3.x.x

If you get that, Python is correctly installed and ready to use in the next chapters.

Views: 14

Comments

Please login to add a comment.

Don't have an account? Register now!