I want to run directly without learning to walk. After learning a little python, I want to find the source code of some small games to play, but I need a library called pygame during the running process. After some exploration, I finally found a relatively simple (wu) Single (nao) installation method.
The first step—>下载及安装
Cmd to open a command prompt, direct input py -m pip install -U pygame --user
and then press the Enter key, download and install pygame library is automatically started.
Step Two—>检测是否成功
First, in a terminal pythom
enter shell
, then type import pygame
, press the Enter key, if the installation was successful if the version number is displayed below the (ps: it should not fail, I have installed uninstalled many times.)
Step Three—>开始测试小游戏啦!
What I found here is a little snake-eating game (the source code I found directly, the level is limited, I can’t write it yet), let’s see the effect?
(It’s not my dish, but the speed setting is really fast?)
Attachment 1: It will be needed during the installation process. pip
In my opinion, this is also more torturous. When installing other libraries, it will be used after some exploration. Detailed tutorials can be searched by yourself.
Appendix 2: Uninstall pygame库
direct inputpip uninstall pygame
欢迎大佬赐教