Bear in mind that pygame has dropped support for python 2. The best way to install pygame is with the pip tool (which is what python uses to install packages).
... and notes\pygame.py", line 2, in <module> from pygame.locals import * ModuleNotFoundError: No module named 'pygame.locals'; 'pygame' is not a package.
Pygame displays as "not a package" 2021-02-18 19:16 Chaotic_Raccoon imported from Stackoverflow. python; pygame; So i've installed pygame and confirmed the installation (aliens example), but it just says this when I use pygame:
24.11.2017 · 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).
Find the example games with the PyGame package, (On a windows system, something like C:\Python3\Lib\site-packages\pygame\examples) and play the Aliens game. Then read the code, in an editor or Python environment that shows line numbers. It does a number of much more advanced things that we do, and relies on the PyGame framework for more of its ...
The pygame package represents the top-level package for others to use. Pygame itself is broken into many submodules, but this does not affect programs that use pygame. As a convenience, most of the top-level variables in pygame have been placed inside a module named pygame.locals pygame constants .
Answer (1 of 2): In general, get rid of both Windows and PyCharm - when it comes to Python, Windows is a second-class citizen, almost no developers bother to test their stuff there… If you insist, though, it’s probably best to try installing PyGame through PyCharm itself - …