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://www.cnblogs.com/jiekk/archive/2012/03/29/2423602.html http://stackoverflow.com/questions/4750806/ 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,http://www.pygame.org/download.shtml, there is no qualifying Win64 bit

Finally ran to the unofficial library http://www.lfd.uci.edu/~gohlke/pythonlibs/, 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

Http://zengrong.net/post/2169.htm

3: The reported error:

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

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

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

+++++++++++++++++++++++++++++++++

Excerpted from http://blog.csdn.net/meylovezn/article/details/18080515

and a http://jingyan.baidu.com/article/e4d08ffdb6a5040fd2f60dfe.html.

The ultimate solution for coding problems:
Create a new sitecustomize.py 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
hl
D:\PYTHON\PYGAME-1.9.2A0-CP27-NONE-WIN_AMD64.WHL isn't compatible with this PYT
Hon.--force to install anyway.

Workaround:


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.

Thanksgiving.

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

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: info-contact@alibabacloud.com 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.