Beginner guides › Install Python
Install Python on Windows or Mac
Download the free installer from python.org, run it (on Windows, tick "Add python.exe to PATH"), then check it works with one command. 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.
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 you have a file ending in .py that you want to run.
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.
Install Python on Windows
Download it
Go to python.org/downloads and click the big yellow download button. It picks the right version for your computer.
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 typepythonlater. If you missed it, run the installer again and choose Modify, or see Quick fixes below.Check it worked
Press the Windows key, type Terminal (or Command Prompt) and open it. Type this and press Enter:
Type thispython --version
You should see something like Python 3.14.0. The exact number doesn't matter.
Install Python on a Mac
Download it
Go to python.org/downloads and click the yellow download button for macOS.
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.
Check it worked
Press Cmd+Space, type Terminal and press Enter. Type this and press Enter:
Type thispython3 --version
On a Mac it's python3. Usepython3wherever a guide sayspython, andpip3forpip.
Write and run a tiny script
Make a test script
Open Notepad (Windows) or TextEdit in plain text mode (Mac) and paste these two lines:
Copy thisname = input("What's your name? ") print("Hello, " + name + "! Python is working.")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.
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
cdand a space, drag the folder from Finder into the Terminal window, then press Enter.Run it
Type the command below (use
python3on a Mac) and press Enter. Type your name when it asks and it says hello back.Type thispython hello.py
Installing add-ons with pip
Some scripts need an add-on, called a package. The script's instructions 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):
python -m pip install pygame
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.