import sys
import pygame
def run_game():
pygame.init()
screen=pygame.display.set_mode((1200,800))
pygame.display.set_caption("Space Battle")
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
sys.exit()
pygame.display.flip()
run_game()
Traceback (most recent call last):
File "C:/Users/Dell/PycharmProjects/test/test.py", line 3, in <module>
import pygame
ModuleNotFoundError:没有名为“ pygame”的模块
我已经安装pygame并在Windows的cmd上执行了导入命令。
我该如何解决这个问题?
如果您的PC中有多个python编辑器,请确保已将pygame安装到正确的python编辑器中