Notes on the Python pygame installation process

  • 2020-06-01 10:21:27
  • OfStack

You saw a tutorial today about installing the pygame module on Python. Feel good, share 1.

Install Python

Well, this little problem seems redundant here. But in order to take care of the children who have just learned Python, I would like to say a few more words.

The details are as follows:

We're going to the Python website. Go download the version we need. What I downloaded here is windows 64-bit Python 2.7 msi. If you do not understand the installation process, select as the default.

Install easy_install

And what is it? We don't have to worry, we just need to know that it will help us install some libraries. The installation process is simple, just download the library and install it using the python command.

Install pip

Well, after the first two steps, I think everyone (especially the beginner's shoes) will be very upset, how to need to pack so many things. But don't despair, for better days are just around the corner. pip is an artifact that can free you from the complex labor of installing a library. Let's take a look at 1 to see how to install pip.

Before you do this, make sure that Python and easy_install are installed on your windows system.

Signs of successful installation:

Microsoft Windows [ version  6.1.7600]
 All rights reserved  (c) 2009 Microsoft Corporation . All rights reserved. 

Python 2.7.11 (v2.7.11:6d1b6a68f775, Dec 5 2015, 20:40:30) [MSC v.1500 64 bit (
AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()

C:\Users\Administrator>easy_install -version
usage: easy_install [options] requirement_or_url ...
  or: easy_install --help

error: option -r not recognized


The next step is to switch to the Script folder in the python installation directory and type
easy_install pip. Of course, you can configure this path into your environment variables if you want to make it easier. (there are many online tutorials on how to do this. I won't repeat the wheel.

Verify 1:

C:\Users\Administrator>pip -v

 pip <command> [options]

 install           Install packages.
 download          Download packages.
 uninstall          Uninstall packages.
 freeze           Output installed packages in requirements format.
 list            List installed packages.
 show            Show information about installed packages.
 search           Search PyPI for packages.
 wheel            Build wheels from your requirements.
 hash            Compute hashes of package archives.
 completion         A helper command used for command completion
 help            Show help for commands.

General Options:
 -h, --help         Show help.
 --isolated         Run pip in an isolated mode, ignoring
               environment variables and user configuration.
 -v, --verbose        Give more output. Option is additive, and can be
               used up to 3 times.
 -V, --version        Show version and exit.
 -q, --quiet         Give less output.
 --log <path>        Path to a verbose appending log.
 --proxy <proxy>       Specify a proxy in the form
 --retries <retries>     Maximum number of retries each connection should
               attempt (default 5 times).
 --timeout <sec>       Set the socket timeout (default 15 seconds).
 --exists-action <action>  Default action when a path already exists:
               (s)witch, (i)gnore, (w)ipe, (b)ackup.
 --trusted-host <hostname>  Mark this host as trusted, even though it does
               not have valid or any HTTPS.
 --cert <path>        Path to alternate CA bundle.
 --client-cert <path>    Path to SSL client certificate, a single file
               containing the private key and the certificate
               in PEM format.
 --cache-dir <dir>      Store the cache data in <dir>.
 --no-cache-dir       Disable the cache.
               Don't periodically check PyPI to determine
               whether a new version of pip is available for
               download. Implied with --no-index.


Install pygame

To install pygame, you must download the file first. So we need to download 1. pygame file download. Remember to download your version of Python.

After downloading it, we will find that it is a file with the suffix.whl. This is awkward. How do I open it?

The answer is to use another tool, wheel. wheel is essentially an zip package format that USES the.whl extension for the installation of the python module, which appears as a replacement for Eggs. wheel also provides an bdist_wheel as an extension to setuptools, which can be used to generate the wheel package. Under wheel1, check whether the installation is successful.

Installing wheel is a lot more fun this time. Because we already have pip.

pip install wheel . Got it.

Now let's go back to pygameXXXXX.whl, wheel file name. Okay, we're done.

Validation under 1

Python 2.7.11 (v2.7.11:6d1b6a68f775, Dec 5 2015, 20:40:30) [MSC v.1500 64 bit (
AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pygame

No error was reported, which means the installation was successful. Let's start the journey of pygame.


The overall installation process is very confusing. Especially for those who just started the children's shoes. But it was also the most valuable experience. Because the installation of these libraries will make you more familiar with the architecture of Python. The overall structure will be better.

Related articles: