Setting up Python on your own PC

This is a quick guide to getting Python set up on your home computer. I'm going to assume you're using Windows, but if there's any interest in doing it on other operating systems, let me know and I'll write something for that

Check if it's installed

You might not be familiar with the command line, but we're going to use it now. It's just a way of sending typed commands directly to your computer. To open it, click the Start button and type "cmd". A link should appear called "Command prompt". Click that, and a small black window will open up. in that window, type: python --version and if it's installed it will say something like Python 3.12.2. If it gives you an error instead, you need to install it.

Installing Python on Windows

The easiest (if slightly limiting) way, if you're new to this, is to install it from the Microsoft store. Again, click the Start button and type "store", then click on the Microsoft Store link. When the Store app opens, type "python" in the search box and pick the latest version - at the time of writing, that's 3.13. Click the Get button, and it should install.


Alternatively, a more fully-featured option is to download and run the Windows installation package from the Python website. You can find that HERE You probably want the most recent stable version, and probably in the flavour Windows installer (64-bit). Download that and run it - you can leave the various options as they are - and once it's done, you have Python!

The Next Steps

You can now check it's installed again by typing "python --version" into the command prompt. But how do you know if it's working? Fortunately, the installation adds a simple development environment, called IDLE - Integrated Development and Learning Environment. Click the Start button again, and type "idle", then open the app that appears. What you get is a something called IDLE Shell. The Shell is also sometimes called a REPL (which stands for Read-Eval-Print Loop), and it has some similarities to the command line you've just used - you can type in commands, and it will run them immediately and print any output. It will also display output from files that you run, but more on that in a minute. For now, let's try it. Type something like this:

print("Hello World!") (because the Law of Computing says you must) and press [enter] - you should see: Hello World!

Or

print(24 * 48) And press [enter] - you should see: 1152

Great! You've run some Python!

A New File

That, of course, is a bit limiting. You're not going to code your blockbuster epic arcade hit like that. You need a file to work on. And IDLE lets you do that. Click File -> New File, and a new window will open up. In the window, type something like:

a = "I like peas" b = "But peas like cheese" c = "That's why they love my Cheesy Knees." d = a+" "+b+" "+c print(d)

Save the file somewhere convenient, then click Run -> Run Module (or hit F5). You should see the output appear in the Shell window, like this:


Pygame and Pygame Zero

To have some proper fun, we want to output things to a window. Draw, make sprites, use colours. To do this, we're going to use a couple of libraries: Pygame, and Pygame Zero (which adds a bit of simple functionality to Pygame). Fortunately, when we installed Python it added a tool called Pip (Package Installer for Python), which makes this simple. Also fortunately, if we install Pygame Zero, it will automatically install Pygame for us. Open a command prompt again (or go back to it if it's still open) and type:

pip install pgzero

And that should be all there is to it. Now to test it, change the code in your Python file (or make a new file) so it reads:

import pgzrun WIDTH = 400 HEIGHT = 300 def draw(): screen.fill((128, 240, 0)) pgzrun.go()

This should create a window, 400px x 300px, and fill it with a shocking lime green. Save it and run, and you should get:


Got it? If so, Yay!!! You're all set up! Now go and make a game!

What now?

You've just levelled up. But where do you go from here? You could install a different development environment - Thonny, which you may have used already, or something with more features like PyCharm, os Visual Studio Code. Find a tutorial to get you started, or sign up for the next CCC Beginners Python course, or the more advanced Platformer course. Go old skool and read a book (there's a very good one you can read here). Ask us questions. Start small, aim big. Have fun!

And let us know how you get on :)