The second month of "Beginner python"-----------------------Pygame

Source: Internet
Author: User

Python is very extensible because there are a lot of pants and bags that can be swapped, oh, it's the library and the package.

Whatever, after Gobang, there are XJM and HH and other people's advice, I also think you can try to learn to use these libraries to write a better game program.

Here's the question, how do I install these libraries?

The question was undoubtedly answered with XJM and without mercy ...

As if I had not searched and ran to ask him, fortunately, HH showed me the street lamp, with Pip and then use pip install MODE.

Personally speaking, I think learning language grammar and logic are OK, after all, the language can be migrated to each other, but each encounter this configuration problem, or will be very faint.

So maybe I'll tidy up the process of doing these things (it feels more dizzy than walking in the maze)

1 cmd install pip

Refer to these two posts--

Http:// How-to-install-pip-on-windows 2 Install target library Pygame probably because it is Win7 64bit, so all failed. [Insert picture is too troublesome, or text parsing it. ]lookuperror:unknown encoding:cp65001 Normal mode into the CMD target directory \pip install Pygame (Target Library) will encounter this problem.

Need to modify the encoding (UTF-8) to Simplified Chinese (GBK)

Executing chcp in CMD window 936

But I still can't find the target library,

Then go to the official pygame,, there is no qualifying Win64 bit

Finally ran to the unofficial library, found the eligible Win64 bit pygame, the problem is I will not WHL

Pip Install wheel failed, so pip install PYGAME.WHL is not possible


3: The reported error:

Unicodedecodeerror: ' ASCII ' codec can ' t decode byte 0xb9 in position 7:ordinal not in range (128)

Create a new under the Python lib\site-packages folder
File, enter:

Import Sys
If sys.getdefaultencoding ()! = ' GBK ':
Reload (SYS)
Sys.setdefaultencoding (' GBK ')


Excerpted from

and a

The ultimate solution for coding problems:
Create a new under the Python lib\site-packages folder
File, enter:
Import Sys
Sys.setdefaultencoding (' gb2312 ')

One thing to note here is that you can set GBK or UTF8 or other types of encoding format, not necessarily gb2312, mainly to see what encoding format you need to manipulate the environment.


Then finally pip install wheel success

You think this is over, and you put the pygame on, didn't you? Yes!

4 Error message:

Successfully installed wheel-0.24.0

C:\python27\scripts>wheel Install D:\PYTHON\PYGAME-1.9.2A0-CP27-NONE-WIN_AMD64.W
D:\PYTHON\PYGAME-1.9.2A0-CP27-NONE-WIN_AMD64.WHL isn't compatible with this PYT
Hon.--force to install anyway.


C:\python27\scripts>pip Install D:\PYTHON\PYGAME-1.9.2A0-CP27-NONE-WIN32.WHL
Processing D:\PYTHON\PYGAME-1.9.2A0-CP27-NONE-WIN32.WHL
Installing collected Packages:pygame
Successfully installed PYGAME-1.9.2A0

I know I said people will not believe that they are clearly installed Win7 64bit of python2.7, what the hell Ah!

If you take my turn, you might as well kill me.

/*** PostScript * * *

Finally solve this wave of problems, if not because of this blog, and a good friend HH help, I think I can't stand down.

Every seed buried in the ground, before the germination, must first break through the thick shell, otherwise it will rot in the mud, although the shell once protected the seeds.


The second month of "Beginner python"-----------------------Pygame

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.