No history yet

Pygame Installation

Transcript

Beau

Okay, so. We're actually going to do it. We're going to build a game.

Jo

We are. And before we can draw our first pixelated alien or make a character jump, we have to... set up our workshop.

Beau

The boring part. The part where I get everything wrong and spend two hours on Google.

Jo

Hey, it's not boring, it's foundational! And it's not that bad, I promise. First things first, we need Python. Do you have it installed already?

Beau

I think so? I have a Mac, and I'm pretty sure it comes with Python pre-installed. I typed it in the terminal once and... something happened.

Jo

Right, and that's a classic first step and a common little trap. So, most operating systems, like macOS and Linux, do come with a version of Python. But it's often an older version, and it's kind of... tangled up with the system itself. It's best practice to install a fresh, modern version that's just for you, for your projects.

Beau

Ah. So my computer's Python is for my computer, not for me. Got it. So where do I get... my Python?

Jo

The official source is python.org. You just go there, head to the downloads section, and it'll usually have a big button with the latest stable version. Right now it's Python 3-point-something. You just download the installer and run it.

Beau

And just click 'Next' a bunch of times like I do with every other piece of software?

Jo

Almost. There is one really, really important checkbox, especially if you're on Windows. During the installation, it will ask if you want to 'Add Python to PATH'. You absolutely want to check that box.

Beau

Add... to path. What does that even mean? It sounds like something from an old adventure game. 'You have added Python to your path.'

Jo

Basically, your computer has a list of 'paths,' which are just folders where it looks for programs. By checking that box, you're telling your computer, 'Hey, if I ever type 'python' into my command prompt, I want you to look in this specific folder where we just installed it.' It lets you run Python from anywhere, which is crucial.

Beau

Okay, so check the magic box. Done. So now I have Python. Am I ready to make a game?

Jo

Not quite. Python is the language, but it doesn't know how to draw shapes or handle keyboard presses or play sounds on its own. We need to give it those powers. That's where Pygame comes in. It's a library, or a... a toolkit, that adds all those game-making abilities to Python.

Beau

So Python is like the empty workshop, and Pygame is the box of power tools.

Jo

Exactly. And to get those tools, we use something that came with our Python installation. It's called 'pip'.

Beau

Pip? Like a... like a fruit seed?

Jo

It stands for 'Pip Installs Packages,' which is a bit of a recursive acronym. But basically, it's Python's package manager. Think of it as an app store for Python toolkits. You just tell it what you want, and it goes out to the internet, finds it, and installs it for you.

Beau

Okay, that makes sense. So I open up my... terminal? Command prompt? The scary black box with text?

Jo

That's the one. And you just type a simple command: `pip install pygame`.

Beau

That's it? Pip, install, pygame. And if that works... what happens? Text just scrolls by?

Jo

Yep, you'll see it say it's collecting Pygame, downloading it, and then... 'Successfully installed'. That's the magic phrase. If you see that, you're pretty much golden.

Beau

Okay, but what if I don't see that? What if I get 'pip: command not found'? That's happened to me before.

Jo

And that is almost always because that 'Add Python to PATH' box wasn't checked. The computer doesn't know where to look for the 'pip' program. On some systems, you might have to type `python -m pip install pygame`. That's basically telling the computer 'Hey, find Python first, and then use its pip tool to install Pygame.'

Beau

It all comes back to the path. So, assuming I see 'Successfully installed'. How do I know it *really* worked? How do I verify it?

Jo

My favorite way to do this is to run one of Pygame's built-in examples. It's a quick, visual confirmation. In that same terminal window, you type: `python -m pygame.examples.aliens`.

Beau

Aliens? Okay, I'm typing it... whoa. Okay, a little window just popped up with a bunch of bouncing alien sprites and some shooting sounds. This is amazing.

Jo

And that's it. If you see that window, your workshop is set up. Python is installed, the Pygame toolkit is on the shelf, and everything is plugged in. The foundation is laid.

Beau

That actually wasn't scary at all. A little bit of setup, one command, and now... aliens. I feel powerful.

Jo

Good. Because next, we're going to open a blank file and make our own window pop up. No aliens yet, just... a blank canvas.