Reputation: 47
I have sucessfully installed pygame on my Windows 10 computer, using Python3.6, here's my code :
import pygame
from pygame.locals import *
pygame.init()
window = pygame.display.set_mode((800,600))
Python says the following :
Traceback (most recent call last):
File "C:/Users/Yann/AppData/Local/Programs/Python/Python36-32/Files/ProjetASINFO/lolol.py", line 2, in <module>
from pygame.locals import *
ModuleNotFoundError: No module named 'pygame.locals'
Have you any ideas about what could happen ? (My file isn't named pygame.py).
Upvotes: 3
Views: 496
Reputation: 33744
As the comments stated, you might've installed a different old version of pygame, you will need to delete the old one and install the newest version from here and choose pygame‑1.9.3‑cp36‑cp36m‑win32.whl: http://www.lfd.uci.edu/~gohlke/pythonlibs/#pygame
If it still does not work, check over your files and see if there's another pygame.py
somewhere else in your $PATH. Also, check out this post as it contains similar questions to yours.
Upvotes: 1