Beginner guides › Install Python

Install Python on Windows or Mac

Some projects, like file sorters and photo renamers, are Python scripts rather than web pages. They need Python on your computer. Here's how to install it, check it works, and run your first script.

Easy 10 minutes Free · from python.org Windows & Mac
Do you need it?

Only for scripts and programs

Every web page project on this site runs in your browser, so you don't need Python for those. You need it when a guide says "Python script", or when the AI gives you a file ending in .py.

Python is free, made by a non-profit, and used by millions of people. Installing it is safe and you can remove it later like any other app.

Windows

Install Python on Windows

  1. Download it

    Go to python.org/downloads and click the big yellow download button. It picks the right version for your computer.

  2. Run the installer

    Open the file you downloaded. If you see a checkbox saying Add python.exe to PATH, tick it, then click Install Now. If you're offered the newer Python install manager instead, run it and say yes to its questions.

    That checkbox matters. It's what lets you type python later. If you missed it, run the installer again and choose Modify, or see Quick fixes below.
  3. Check it worked

    Press the Windows key, type Terminal (or Command Prompt) and open it. Type this and press Enter:

    Type this
    python --version

    You should see something like Python 3.14.0. The exact number doesn't matter.

Mac

Install Python on a Mac

  1. Download it

    Go to python.org/downloads and click the yellow download button for macOS.

  2. Run the installer

    Open the .pkg file and click through with Continue and Install. Enter your Mac password when asked. When it finishes, a Finder window opens: double-click Install Certificates.command in it. This lets Python download things safely.

  3. Check it worked

    Press Cmd+Space, type Terminal and press Enter. Type this and press Enter:

    Type this
    python3 --version
    On a Mac it's python3. Use python3 wherever a guide says python, and pip3 for pip.
Your first script

Run something the AI wrote

  1. Ask for a tiny test script

    Copy this prompt
    I'm a complete beginner and I've just installed Python. Please write me a very short Python script that asks for my name and then says hello and tells me today's date.
    
    Give me the complete script, tell me what to name the file, and tell me exactly how to run it on [Windows / Mac].
  2. Save it as a .py file

    Save it the same way as an HTML file (see How to save and open an HTML file), but end the name with .py, for example hello.py. Make a folder for your scripts, such as Documents › scripts.

  3. Open a terminal in that folder

    Windows: open the folder in File Explorer, click the address bar, type cmd and press Enter. A terminal opens in that folder.

    Mac: open Terminal, type cd and a space, drag the folder from Finder into the Terminal window, then press Enter.

  4. Run it

    Type the command below (use python3 on a Mac) and press Enter. Answer its question and it says hello back.

    Type this
    python hello.py
ADVERTISEMENT · IN-ARTICLE
Extras

Installing add-ons with pip

Some scripts need an add-on, called a package. The AI will tell you its name, for example pygame for games or openpyxl for Excel files. Install it like this, in a terminal (Mac users type python3):

Type this
python -m pip install pygame
Only install what you asked for. Stick to packages the AI names for your project, and if you're unsure, ask it: "Is this a well-known, safe package?"
If it goes wrong

Quick fixes

Windows says 'python' is not recognised

Python isn't on your PATH. Try typing py instead of python. If that doesn't work, run the installer again, choose Modify, and tick Add Python to environment variables. Close and reopen the terminal afterwards.

Typing python opens the Microsoft Store

Windows has a shortcut that does this. Either install Python from python.org as above, or turn the shortcut off: Settings › Apps › Advanced app settings › App execution aliases, and switch off the two python entries.

Mac says 'command not found: python'

On a Mac the command is python3. If that's not found either, the installer didn't finish: run it again.

No such file or directory

The terminal isn't in the same folder as your script. Repeat the step above to open a terminal in the right folder, or check the file name really ends in .py and not .py.txt.

SSL or certificate errors when installing a package (Mac)

Open Applications › Python 3.x in Finder and double-click Install Certificates.command, then try again.

What about a Chromebook?

You can turn on Linux in Settings › About ChromeOS › Developers › Linux development environment. Python comes with it. Most school and work Chromebooks block this, so ask your administrator.

Keep going

Where next