Himanshu SharmaSoftware engineer
Let’s talk

Python Tutorial · Lesson 2 of 70

Installing Python on Windows, macOS and Linux

Install Python 3 on Windows, macOS or Linux and check that it works by running a version command in your terminal, with fixes for common problems.

8 minGetting startedUpdated 14 November 2026

Awaiting technical review. This lesson is readable but not yet listed in search engines.

By the end of this lessonInstall Python 3 on your computer and confirm from the terminal that the right version is ready to use.

After this lesson you will have Python 3 on your computer and know how to check it. Installing is a one-time job, and the steps depend a little on your operating system. Read the part for yours.

The commands in this lesson are shown for you to type yourself in a terminal. They have no output here because the result depends on your own machine.

First, check whether you already have it

Many computers already have Python. Open a terminal (called Terminal on macOS and Linux, and Command Prompt or PowerShell on Windows) and run:

bash
python3 --version

If you see a version number that starts with 3 and is 3.9 or higher, you are done and can skip to the next lesson. If you see a lower version, an error, or nothing useful, follow the steps for your system below.

Windows

Go to python.org in your browser, open the Downloads section and download the installer for Python 3. Run it and follow the screens. If the installer offers an option to add Python to your PATH, tick it, because that lets the terminal find Python by name. Finish the installation, then close any terminals that were open and start a new one.

In a new terminal, check the installation with one of these:

bash
python --version
py --version

On Windows the command is often python rather than python3. If one of these prints a Python 3 version, that is the command you will use throughout the tutorial wherever you see python3.

macOS

The simplest route is the same: download the installer for Python 3 from python.org and run it. If you already use Homebrew, the package manager many developers install on a Mac, you can instead run:

bash
brew install python

Afterwards, open a new terminal window and check with python3 --version. On a Mac, use python3 rather than python.

Linux

Most Linux distributions come with Python 3 already. You can check with python3 --version. If it is missing or too old, install it with your distribution's package manager. On Debian and Ubuntu, for example, the command looks like this:

bash
sudo apt install python3

Other distributions use different package managers, such as dnf or pacman, so use whichever your system provides. Then check the version again.

Which version do I need?

Any Python 3.9 or newer works for this tutorial. You do not need the very newest release. The examples avoid features that only exist in recent versions, so what you learn applies wherever you use Python.

An editor

You also need somewhere to write code. Any plain text editor works. A code editor such as Visual Studio Code, which is free, adds colours and helpful hints. Python also includes a simple editor called IDLE in many installations, but you do not have to use it. Pick one and stay with it while you learn.

Common mistakes

  • Checking in a terminal that was already open. A terminal started before the installation may not see the new Python. Close it, open a new one and try again.
  • Using the wrong command name. Some systems use python3, others python. If one says "not found", try the other. On Windows you can also try py.
  • Having an old Python as the default. If a version command shows something below 3.9, you are running an old copy. Install a newer one and check again.
  • Typing the prompt symbol. When a guide shows a line like $ python3 --version, the dollar sign is the prompt. Type only the part after it.
  • Following a guide for a different system. Commands for Linux, such as apt, do not work on Windows or macOS.

Exercise

Open a terminal and find out which Python 3 version you have. Write down the exact command that worked on your machine. Then decide whether it is 3.9 or newer.

Show one possible answer

On many macOS and Linux machines the command is:

bash
python3 --version

On many Windows machines it is python --version or py --version. Whichever one prints a version starting with 3 is your command. If the number is 3.9 or higher you are ready for the next lesson. If it is lower, install a newer Python using the steps above and check again. Your exact output will differ from anyone else's, which is why no output is shown here.

Next: write your first Python program.

Key points

  • Get Python 3 from the official site python.org, or from your system's package manager on macOS and Linux.
  • After installing, open a new terminal and run python3 --version (or python --version on some systems) to check it.
  • Python 3.9 or newer is enough for everything in this tutorial.
  • If the command is not found, the usual cause is a terminal opened before installation, or Python not being on your PATH.

Check yourself

1. How can you check that Python is installed?
2. Which version of Python is enough for this tutorial?
3. You installed Python but your terminal says the command is not found. What should you try first?
4. What is a good reason to choose the installer from python.org?