Why does it say that module pygame has no init member?

前端 未结 14 1183
予麋鹿
予麋鹿 2020-12-01 13:57

This is the code I have:

import pygame
pygame.init()

I\'m very confused because if I try to run the file, then there seems to be no issue,

14条回答
  •  情深已故
    2020-12-01 14:35

    Check if you have a python file named pygame.py created by you in your directory. If you do, then the import pygame line is importing your own file instead of the real Pygame module. Since you don't have an init() function in that file, you're seeing this particular error message.

提交回复
热议问题