Pygame 窗口未在 macOS Catalina 上显示

dbu*_*nok 6 python macos pygame macos-catalina

运行:
macOS Catalina 10.15.1
Python 3.8.0
Pygame 1.9.6
IDE - Visual Studio Code 1.40.2

当我启动 Pygame 测试时:

python3 -m pygame.examples.aliens
Run Code Online (Sandbox Code Playgroud)

音乐开始播放,大约 5 秒后应用程序关闭。没有窗口出现。Dock 中的图标会一直显示,直到它关闭。

同样的事情发生在一个基本的测试代码上,比如

import pygame

pygame.init()
screen = pygame.display.set_mode((400, 300))
done = False

while not done:
        for event in pygame.event.get():
                if event.type == pygame.QUIT:
                        done = True

pygame.display.flip()
Run Code Online (Sandbox Code Playgroud)

终端中没有错误消息。

有人有这个问题吗?我已经尝试从网站上重新安装 Python 3.8.0(在另一个线程中推荐)以及 Pygame。

小智 0

这个解决方案是由furas这个评论中给出的:

也许安装 Python 3.7。Python 3.8 是非常新的版本,许多模块尚未准备好或未针对该版本进行测试。

这适用于 Python 3.7.8。