我最近在Python中安装了PyGame,但是发生了一些奇怪的事情。当我导入它并在终端中使用它时,它可以正常工作,但是当我尝试在idle
中使用它时,它根本不起作用。有人知道为什么会这样吗?
import pygame
pygame.init()
win = pygame.display.set_mode((500, 500))
退出并显示错误:
>Traceback (most recent call last):
File "C:/Users/USER/PycharmProjects/Primer Python/Basico/pygame.py", line 1, in <module>
import pygame
File "C:\Users\USER\PycharmProjects\Primer Python\Basico\pygame.py", line 2, in <module>
pygame.init()
AttributeError: module 'pygame' has no attribute 'init'