PyGame is a set of cross-platform modules in the Python programming language, which means you can install it on any operating system, and this article from MiniTool Partition Wizard tells you how to install PyGame on Windows 10.
How to Install PyGame on Windows 10?
PyGame depends on Python, which means you must install Python before installing PyGame. Here is the guide about installing PyGame on Windows 10.
Install Python on Windows 10
Step 1: Visit the Python website and download the latest version of Python 3. If you are using a 32-bit system, please select Windows installer (32-bit); if you are using a 64-bit system, please select the Windows installer (64-bit).
Do you know what difference between 32 bit and 64 bit? What does x86 and x64 mean? In today’s article, you will get detailed information about x64 vs x86.
Step 2: Open the Python installer, check the Install launcher for all users (recommended) and Add Python 3.10 to PATH boxes. Then click Install Now.
Or you can click the Customize Installation option and make sure the following boxes are checked: Documentation, pip, tcl/tk and IDLE, Python test suite, py launcher, for all users (requires elevation). Then click Next.
After entering the Advanced Options dialog box, you must also check the following boxes here: Install for all users, Add Python to the environment variables. Others you can choose according to your needs. Then click Install.
Install PyGame on Windows 10
Once finish Python setup on Windows 10, you can start to try installing PyGame on Windows 10.
Step 1: Locate the Python folder.
By default, the Python folder is located at C:Program Files. So, you can open the File Explorer and then go to the path to locate the Python folder.
Step 2: Copy the path/address of the Python folder.
Right click the Python name at the top of the File Explorer screen, and then click Copy Address. The copied address looks like “C:Program FilesPython310”.
Step 3: Create the path.
After copying the address, you need to create a path in the environment variable.
- Open the Control Panel and navigate to the path: System and Security > System > Advanced System Settings > Environment Variables.
- Choose Path and click Edit > New, and then paste the path copied from the File Explorer into the empty text box generated on the environment variables panel.
- Click OK twice to save the changes.
Step 4: Open Command Prompt as an administrator.
- Open the Start menu and search for cmd in the search box.
- Right-clicking the search result and select Run as administrator.
Step 5: In the Command Prompt, type cd and a space, and then right-click in the Command Prompt to paste the path into Python. Then press Enter.
cd C:Program FilesPython310
Step 6: Type cd Scripts in the command prompt and press Enter.
Step 7: Type pip install pygame and press Enter to install Pygame.
Pygame should have been successfully installed on Windows 10. To verify this, type python and press Enter to start the Python interactive interpreter. Then type import pygame in the interpreter and press Enter.
If there is no error after typing import pygame in the interpreter, you have successfully installed Pygame on Windows. You can now use the Pygame library to write any graphics program you want.
The Python is not recognized as internal or external command issue when running Windows Command Prompt, but it confuses many people. Here are fixes.
As you can see, a complete guide on how to install PyGame on Windows 10 is illustrated in the post. If you have any questions about this method, please leave them in the comment zone and we will try to answer them as soon as possible.