Different Ways to Install Pygame on Windows Operating System

How to Install Pygame on Windows

libraries and framework feature which makes even the difficult tasks easy. One similar library is Pygame which you can use to create fun and unique 2D games. In this article, we will discuss different ways to install Pygame on Windows OS.

Things to Do Before Installing Pygame on Windows

There are certain things you need to check before installing Pygame as they are important for successful installation. The first is finding out whether the Python app is available on your device or not. Follow these steps:

Image 2 – python version

  1. Click on Start menu and go to “Search” option.
  2. Type “Command Prompt” and press “Enter” key.
  3. Once the Command Prompt window is open type the following command and press Enter.
  4. “python –version”
  5. If Python is present on your device you will be able to see the Python version. This means you are ready for the next step.
  6. In case the command does not run successfully then you need to install the latest version of Python on your device.

Things to Do Before Installing Pygame on Windows

The next thing is to check for PIP installation. It is a tool use to install packages on Python. If you have Python with version 2.7.9+ or Python 3.4+ then PIP will automatically install with Python installation. To see whether PIP is available or not do the following steps:

pip install

  1. Open “Command Prompt” through Start Menu.
  2. Type this command and press the “Enter” key.
  3. “pip –version”
  4. If the command runs successfully then it is available on your device.

After you have successfully done both of the following, now you are ready to install Pygame on Windows.

Ways to Install Pygame on Windows

There are three main ways through which you can install Pygame and all of them are simple to follow through. All you need to do is adhere to the instructions given with each step in order and you can get Pygame in no time.

Installing Through PIP

The most basic and easiest way to install Pygame is via PIP. This is done by the majority of Windows users. Just do these steps:

  1. Press the “Win + R” key at the same time. This will open “Run” prompt window.
  2. Type “cmd” in the blank space and press “OK”. cmd run
  3. Wait for “Command Prompt” window to appear on your screen.
  4. Now type the following command and then press “Enter” key.
  5. “pip install pygame” pip pygame
  6. Wait for the command to be executed
  7. Once done, verify the installation by creating a Python Scrip with this code.
  8. “import pygame”
  9. “print(“pygame version:”, pygame.__version__)
  10. If the code runs successfully then Pygame is install on your Windows device.

Installing With PyCharm

If you are more comfortable using PyCharm IDE then this method is especially for you. It is also for those who are facing issues with previous installation ways.


If you don’t have PyCharm on your device then you will need to open any web browser on your system. Now search for PyCharm’s official website to download it from. After downloading, install it on your system by following the given instructions.

  1. Launch PyCharm on your device.
  2. Create a new project by clicking on “File” option and selecting “New Project”.
  3. Now choose “Python” from the list of available options.
  4. In project settings, go to “Python” then “Python Interpreter”. python intrepreter
  5. After that, click on the “Plus” or “+” button to add a package.
  6. Look for “pygame” and then click on “Install Package” button. pycharm pygame
  7. You have now successfully install Pygame on your system.

Installing via Source

Lastly, you can install Pygame through source code. This method is for those who have previously work with source code. If you are not familiar then try doing other methods.

  1. First of all, you need to download the pygame source.
  2. Launch your favorite web browser and click on the address bar.
  3. Search for the pygames official and press Search icon.
  4. On the website, locate “Source”. ource code
  5. Here you will be able to find Pygame source code in zip or tag.gz file format.
  6. Once it is downloaded, extend the code to whatever location you like. Also, make sure to remember or note down this location.
  7. Now, open the Run prompt by pressing “Win and R” keys together.
  8. Type “cmd” and press “Enter”.
  9. In the Command Prompt window, use “cd” to locate the place you have to unzip the source code.
  10. For example “cd C:\Users\YourUsername\Desktop\pygame-1.9.6”.
  11. Now run these commands to build and install.
  12. “python setup.py build”
  13. “python setup.py install” 10 install source
  14. Again wait for the command to finish executing.

You can check it is install on your system correctly by running a simple Pygame code.

  1. Create a Python project “pygame_test.py”. new project
  2. Now type the following code.

import pygame


# Create a window

window = pygame.display.set_mode((400, 300))

# Run the game loop

running = True

while running:

for event in pygame.event.get():

if event.type == pygame.QUIT:

running = False

# Quit Pygame


  1. Run the script with the “python pygame_test.py” command.
  2. If a window appear then Pygame is successfully install on your Windows operating system.


Python is one of the best programming languages due to many reasons among which is its library and framework functionality. With this, you can have things like Pygame which tremendously helps with its simplicity and flexibility in 2D game development. If you want to learn more about it or different ways to install pygame on Windows then read the above article.

Read Also: How To Download YouTube Videos? YT Download