I forget to install the pygame module thats why we face ModuleNotFoundError: No module named ‘pygame’ error in python, pygame is not pre-install module we need to install separately see below command how we can install pygame pip in our operating system.
Error Massage
import pygame
Traceback (most recent call last):
File "/home/kali/python/webproject/Py_Games/pygame/main.py", line 1, in <module>
import pygame
ModuleNotFoundError: No module named 'pygame'
How to install pygame in windows
Firstly you need to open command prompt window so please press Win+X. When the context menu appears, press A. then just copy paste below command.
py -m pip install -U pygame --user
After successfully install then just confirm we below command.
py -m pygame.examples.aliens
How to install pygame in Linux Terminal
Firstly open your Linux Terminal then run below command.
sudo apt-get install python3-pygame
For Linux after successfully install then just confirm we below command.
python3 -m pygame.examples.aliens
How to install pygame in Mac
Firstly open your Mac Terminal then run below command.
python3 -m pip install -U pygame --user
Know we have pygame then use it and try to make beautiful games but if you looking pygame game source code please visited Amol Blog Python Games.

