Installing Python

In the last lesson you saw why Python is worth learning. Now you need it on your own computer so you can actually run code. Let’s get Python installed and make sure it works.

🤔 Why do we even need to install Python?

When you write Python code, that code is just text. Your computer cannot run it on its own. It needs a program that reads your code and runs it. That program is called the Python interpreter.

So installing Python means putting that interpreter on your machine. Here is the situation on most computers:

  • Windows usually comes with no Python at all. You have to install it yourself.
  • macOS does not ship with a ready-to-use Python 3 anymore. You install your own.
  • Linux often has Python 3 already, but it may be an older version. You may want a newer one.

Either way, the goal is the same. Get a recent Python 3 working, so when you type python your computer knows what to do.

🔎 First, check if you already have it

No point installing twice. Before anything else, open your terminal and check. On Windows that is Command Prompt or PowerShell. On macOS or Linux that is the Terminal app.

This command asks Python to print its version number.

Terminal window
python --version

If that prints nothing useful, try this one instead. On macOS and Linux the command is often python3.

Terminal window
python3 --version

Output if Python is installed

Python 3.13.1

If you see a version that starts with 3., you already have Python 3. You can skip ahead to the “check it worked” part. If you see an error like “command not found”, or a version that starts with 2., follow the steps for your system below.

Always use Python 3

Python 2 is old and no longer supported. If your system shows a 2.x version, install a fresh Python 3. Every tutorial here uses Python 3.

🪟 Installing on Windows

  1. Download the installer

    Go to the official site, python.org/downloads. It detects your system and shows a big button to download the latest Python 3 for Windows. Click it and save the .exe file.

  2. Tick “Add python.exe to PATH”

    Open the file you downloaded. At the bottom of the first window there is a checkbox that says Add python.exe to PATH. Tick it before you do anything else. This one checkbox saves you a lot of trouble later.

  3. Click “Install Now”

    Pick Install Now. It uses sensible default settings, so you do not have to decide anything. Wait for it to finish, then close the window.

  4. Open a new terminal and check

    Close any terminal you had open, then open a fresh Command Prompt. Old terminals do not know about the new install. Now run the check command below.

Don't skip the PATH checkbox

If you forget to tick Add python.exe to PATH, the python command will not work in your terminal. The easiest fix is to run the installer again, choose Modify, and turn it on. So just tick it the first time.

On Windows you also get a helper called the py launcher. If python ever acts strange, you can use py instead. For example, py --version does the same check.

🍎 Installing on macOS

The simplest way is the official installer, the same site as before.

  1. Download the macOS installer

    Go to python.org/downloads and download the latest Python 3 for macOS. It comes as a .pkg file.

  2. Run the installer

    Open the .pkg file and click through the steps. The default choices are fine. Type your Mac password when it asks.

  3. Check it in the Terminal

    Open the Terminal app and run the version check. On macOS the command is usually python3.

If you already use Homebrew, the package manager for macOS, you can install Python with a single command instead. This downloads and sets up the latest Python 3.

Terminal window
brew install python

🐧 Installing on Linux

Most Linux systems already have Python 3. If yours does not, or it is too old, you install it through your system’s package manager. On Ubuntu or Debian, this command installs Python 3 and pip (the tool for adding extra Python packages).

Terminal window
sudo apt update
sudo apt install python3 python3-pip

On Fedora, the command looks like this instead.

Terminal window
sudo dnf install python3 python3-pip

✅ Check that it actually worked

No matter which system you used, finish with the same check. Open a fresh terminal and ask for the version.

Terminal window
python --version

If that does not work, try python3 --version. You should see a line starting with Python 3.

Now let’s run real Python code. This command runs a tiny program right from the terminal that prints a message.

Terminal window
python -c "print('Python is working!')"

Output

Python is working!

If you see that message, Python is installed and running. That is the whole goal of this lesson.

🐍 What about pip?

You will hear about pip a lot. pip is the tool that installs extra Python packages, the ready-made tools other people have written. The good news is you do not install it separately. Modern Python 3 comes with pip already inside it.

You can check it the same way you checked Python.

Terminal window
pip --version

If pip does not work, try pip3 --version. We will use pip properly in a later lesson, so don’t worry about it for now. Just good to know it is there.

⚠️ Common Mistakes

A few small things trip people up during install. Watch for these.

  • Forgetting the PATH checkbox on Windows. This is the number one reason python “does not work” after install. Run the installer again and turn it on.
  • Using python when your system wants python3. On many Macs and Linux machines, plain python may be missing or point to old Python 2. Use python3 and pip3 there.
  • Checking in an old terminal window. A terminal that was already open does not see the new install. Close it and open a new one.
  • Installing Python 2. It is dead. Always grab the latest Python 3.

Windows: the Microsoft Store pop-up

On Windows, if typing python opens the Microsoft Store instead of running Python, it means Python is not on your PATH yet. Install it from python.org with the PATH checkbox ticked, and that pop-up goes away.

✅ Best Practices

  • Always install the latest Python 3 from the official site, python.org. It is safe and up to date.
  • Tick “Add to PATH” on Windows. It makes everything afterward easier.
  • Open a fresh terminal to test. It avoids the “it does not work” confusion.
  • Remember python3 and pip3 as backups on Mac and Linux if the plain commands fail.

🧩 What You’ve Learned

You now have Python on your machine. Here is the short version.

  • ✅ Python code needs the Python interpreter installed to run.
  • ✅ You download Python 3 from the official site python.org, or use a package manager like Homebrew or apt.
  • ✅ On Windows, ticking Add python.exe to PATH is the key step.
  • ✅ You check the install with python --version (or python3 --version).
  • ✅ pip comes bundled with modern Python 3, so you do not install it separately.

Check Your Knowledge

Test what you learned. Pick an answer for each question, then click Check.

  1. 1

    Why do you need to install Python?

    Why: Python code is just text. The interpreter is the program that reads it and runs it, so you install that.

  2. 2

    On Windows, which step keeps the `python` command working in the terminal?

    Why: Adding Python to PATH lets your terminal find the `python` command. Forgetting it is the most common install problem.

  3. 3

    How do you check which Python version is installed?

    Why: `python --version` (or `python3 --version`) prints the installed version, like 'Python 3.13.1'.

  4. 4

    What is true about pip in modern Python 3?

    Why: pip ships inside modern Python 3. You can check it with `pip --version` or `pip3 --version`.

🚀 What’s Next?

Python is installed and working. Next, let’s actually run some Python code and see the different ways to do it.

Running Python Programs

Share & Connect