How to set up Python on a computer or phone
You need some way to run Python before lesson 1. There are three routes. Choose the one that matches the device you have. All three are free.
Route 1: install Python on a computer
This is the best route if you have a laptop or desktop. Python is free software, published by the Python Software Foundation on its official website, python.org.
Windows
- Open python.org in your browser and go to Downloads. The site offers the current version for Windows. Download the installer.
- Run the installer. On its first screen, tick the box that adds Python to PATH before you continue. This lets you start Python from the Command Prompt later. It is the step most people miss.
- Choose the standard install and wait for it to finish.
- Open the Start menu and type IDLE. Open the program called IDLE. It was installed along with Python.
Download Python only from python.org or from the Microsoft Store entry published by the Python Software Foundation. Do not use download sites that wrap the installer in their own program.
Mac
- Open python.org, go to Downloads, and download the installer for macOS.
- Open the downloaded file and follow the steps.
- Open Launchpad or the Applications folder and start IDLE from the Python folder.
Linux
Most Linux systems already have Python 3. Open a terminal and type python3 --version. If a version number appears, Python is there. IDLE is usually a separate package in your system's software manager.
Check that it works
Open the Command Prompt on Windows, or the Terminal on Mac and Linux, type the line below and press Enter.
python --versionA line such as "Python 3" followed by more numbers means the install worked. If Windows says the command is not found, try py --version. On Mac and Linux the command is usually python3.
Your first file in IDLE
IDLE opens a window called the Shell, with a >>> prompt. You can type one line there and press Enter to run it at once. That is good for quick tests. For programs of more than a line or two, use a file.
- In IDLE choose File, then New File. An empty editor window opens.
- Type your program, for example
print("Hello, world"). - Choose File, then Save. Give it a name ending in
.py, such ashello.py, in a folder you will find again. A folder namedpython-practicein Documents is a good home. - Press F5, or choose Run, then Run Module. The output appears in the Shell window.
Do not name a file after a Python module, such as random.py or math.py. It causes confusing errors later, explained on the AttributeError page.
A better editor, later
IDLE is plain but enough for this whole course. When you want more comfort, free code editors colour your code, complete names as you type and point out mistakes before you run. There is no hurry. Changing editors does not change the language.
Route 2: run Python in a browser
Many websites offer a box where you type Python and press Run. Search for "online Python compiler" or "run Python online". Nothing is installed, and it works on school and office computers where you cannot install software.
Things to know:
- Most of these sites handle
print,input, loops, lists and functions without trouble, which covers nearly every lesson here. - Reading and writing files (lesson 18) may not work, or the files vanish when you close the page.
- Your code is sent to that site's computer to run. Do not paste anything private, such as passwords or personal data.
- Some sites need a free account to save your work. Copy your programs into a notes app if you want to keep them.
Route 3: Python on a phone
Both app stores have free apps that run Python on the phone itself. Search the Play Store or the App Store for "Python" and choose an app with many good reviews, checking what permissions it asks for. An app that runs Python has no need for your contacts or location.
A phone is fine for the first ten lessons. Typing brackets, colons and indents on a small keyboard gets tiring as programs grow, so try to practise on a computer at least sometimes. If the phone is all you have, turn it sideways for a wider keyboard and be patient with yourself. Many people have learnt this way.
Which Python version?
Any recent version of Python 3 will do for every lesson on this site. Do not install Python 2. It is no longer supported, and its print works differently, which is why some very old tutorials show code that fails today.
Common set-up problems
| Problem | Likely cause | What to do |
|---|---|---|
| "python is not recognized" on Windows | PATH box not ticked | Run the installer again, choose Modify or Repair, and tick the PATH option. Or use py in place of python. |
| The Microsoft Store opens when you type python | Windows shortcut for a missing Python | Install Python from python.org, then open a new Command Prompt. |
| Double-clicking the file shows a black window that vanishes | The program ran and finished | Run it from IDLE with F5, where the output stays. |
| The file opens in Notepad | No .py ending, or the ending is hidden | Save from IDLE with a name ending in .py. |
Once print("Hello, world") runs, you are ready for lesson 1.
Examples on this page were run with Python 3.14 on 12 November 2026. The output shown is the real output.
This is an independent learning site. It is not connected with or approved by the Python Software Foundation. "Python" is a trademark of the Python Software Foundation and is used here only to name the language.