Python doesn't find pygame.locals

I have successfully installed pygame on my windows 10 machine using Python3.6, here's my code:

import pygame
from pygame.locals import *

pygame.init()
window = pygame.display.set_mode((800,600))

      

Python says this:

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'

      

Do you have any idea what might happen? (My file is not called pygame.py).

+3


source to share


1 answer


As pointed out in the comments, you can install a different old version of pygame, you will need to uninstall the old version and install the latest version here and select pygame-1.9.3-cp36-cp36m-win32.whl: http: //www.lfd.uci. edu / ~ gohlke / pythonlibs / # pygame



If it still doesn't work, check your files and see if there pygame.py

is elsewhere in your $ PATH. Also, check this post as it has similar questions to yours.

0


source







All Articles