Home > Backend Development > Python Tutorial > How to install pygame

How to install pygame

DDD
Release: 2023-11-27 15:49:23
Original
6177 people have browsed it

pygame installation steps: 1. Use the "python --version" command to view the installed Python version; 2. Install pip; 3. Download pygame; 4. Enter cmd and enter the command pip install wheel to install wheel; 5. Enter the directory of the .whl file in cmd; 6. Enter Python in cmd, and then enter import pygame to check whether the installation is successful; 7. Install pygame in the editor settings.

How to install pygame

Operating system for this tutorial: Windows 10 system, Python version 3.11.4, Dell G3 computer.

1. python --version Check the installed Python version

Upgrade pip command: python -m pip install --upgrade pip

If already After downloading the installation file, use: pip install file name

If not downloaded, use: python -m pip install --user module name, the system will automatically download

2. If not To install pip, install pip first.

The URL is: https://pypi.python.org/pypi/pip#downloads

 

Just download the second one , after decompression, run setup.py.

Now open cmd and check the pip installation version. Now pip has been installed.

Enter pip list in cmd and you will see all the packages installed using pip.

3. Download pygame:

http://www.lfd.uci.edu/~gohlke/pythonlibs/#pygame

cp27 representative python2.7 version, win32 represents 32-bit operating system. Mine is python3.7, and the system is 64-bit, so what I downloaded is

pygame-1.9.4-cp37-cp37m-win_amd64.whl

The suffix of the downloaded file name is whl, So the next step is to install a program that can run whl files.

4. Install wheel, enter cmd, enter the command: pip install wheel

5. Enter the directory of the .whl file in cmd, My files are placed in (E:\Python\pygame),

The entry method is as follows: Enter the command E: in cmd (enter the E drive first), then enter cd E:\Python\pygame, and finally enter pip install pygame-1.9.4-cp37-cp37m-win_amd64.whl

6. Check whether the installation is successful, enter Python in cmd, and then enter import pygame

7. At this time, pygame cannot be used in the editor. You need to install it in the settings.

Open settings -project interpreter, found that there is no pygame in the project interpreter, click on the right, search for pagame, click on the installation in the lower left corner, and the same goes for installing other modules in the future.

The above is the detailed content of How to install pygame. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template