So this problem is a bit strange for me. I wrote this piece of code to see if pygame works correctly.
import pygame,sys
from pygame.locals import *
pygame.init()
DISPLAYSURF = pygame.display.set_mode((400,300))
pygame.display.set_caption("Hello World")
while True:
for event in pygame.event.get():
if event.type == QUIT:
pygame.quit()
sys.exit()
pygame.display.update()
I saved this file as pygame.py and when I typed:
-python pygame.py
on the cmd it says:
ModuleNotFoundError: No module named 'pygame.locals'; 'pygame' is not a package
And if I type -python to the shell and then type import pygame it works like a charm.
So In summary: If I want to execute pygame.py, it does not see the module,
but it sees the module after typing python and import pygame (works without error).
The operating system is Windows.