For this you have to install pygame package from the cmd (on Windows) or from terminal (on mac). Just type pip install pygame
.If it doesn't work for you, then try using this statement pip3 install pygame
.
If it is still showing an error then you don't have pip installed on your device and try installing pip first.