'How to fix the error "ModuleNotFoundError: No module named 'pygame'"? [duplicate]

I wanted to "compile" the project on pygame using pyinstaller, but when opening the .exe file, this error pops up:

enter image description here



Solution 1:[1]

this could happen because either you havent installed pygame do pip install pygame to fix that or might be because python is not added to you path in environment variable steps to add python to path or it might be that you haven't installed python check here to install it

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Pratik Agrawal