How to Run Python Games on Your Computer
The console games on this site run in your browser, but running Python on your own computer lets you play the keyboard-controlled turtle games, save your work and build bigger projects. It takes about five minutes.
1. Install Python
- Windows: download Python 3 from python.org and run the installer. Tick Add python.exe to PATH on the first screen.
- macOS: download the installer from python.org (the version Apple ships may be old or missing).
- Linux: Python 3 is usually installed. Check with
python3 --version; otherwise install thepython3package. For turtle you may also needpython3-tk.
2. Save the game
Open IDLE (it comes with Python), choose File → New File, paste the game code and save it as something like snake.py. Any editor works: VS Code, Thonny, PyCharm, even Notepad.
3. Run it
- In IDLE: press F5 (Run → Run Module).
- In a terminal: go to the folder and type
python snake.py(Windows) orpython3 snake.py(macOS/Linux).
Fixing common problems
| Message | What it means |
|---|---|
'python' is not recognized | Python isn't on your PATH. Reinstall and tick Add to PATH, or try py snake.py on Windows. |
IndentationError | The paste lost or mixed spaces. Re-indent with 4 spaces per level. |
ModuleNotFoundError: No module named 'tkinter' | Turtle needs Tk. On Linux install python3-tk. |
| The turtle window closes at once | Add turtle.done() at the end of the program. |
ModuleNotFoundError: No module named 'pygame' | Run pip install pygame (only needed for pygame games). |
Check your setup
Save this as check.py and run it. If you see the version and a window with a turtle, you're ready for every game here.
import sys
import turtle
print("Python", sys.version.split()[0], "is working!")
t = turtle.Turtle()
t.shape("turtle")
t.forward(100)
turtle.done()Frequently asked questions
Do I need pygame to run these games?
No. All 20 games use only modules that come with Python, including turtle for the graphical ones.
Can I run Python games on a phone?
The console games run in your phone's browser on this site. Turtle games with keyboard control need a computer or a Python app that supports Tk.