python - pygame.init() 导致崩溃
问题描述
这是我在测试可能导致崩溃的原因时所做的简单测试代码:
import pygame
pygame.init()
print("Hello World!")
问题是当我运行我的代码时,它从不打印Hello World!
,它Hello from the pygame community. https://www.pygame.org/contribute.html
从打印import pygame
,稍等片刻,然后就像我的程序停止了一样。
从终端运行它给出
C:\Users\...\game>py game.py
pygame 1.9.6
Hello from the pygame community. https://www.pygame.org/contribute.html
C:\Users\...\game>
在 IDLE 中一步一步做看起来像
>>> import pygame
pygame 1.9.6
Hello from the pygame community. https://www.pygame.org/contribute.html
>>> pygame.init()
=============================== RESTART: Shell ===============================
>>>
如果我从 Visual Studio 运行它,它会打开一个错误窗口,显示“调试适配器意外退出”。
我已经对该问题进行了广泛的研究,但只发现了两个未答复的帖子。如果可能有帮助,我使用 python 3.6.6 和 pygame 1.9.6(在 Windows 10 上)
解决方案
推荐阅读
- php - 跨域请求被阻止(原因:CORS 预检通道未成功)
- xml - 使用 ansible 修改 JBoss 属性而不更改所有属性标签
- c# - 在 WPF 窗口 ctor 之外找不到文件路径
- maven - maven git-commit-id-plugin:子文件夹/子模块的commitId
- factory - 如何处理价格动态
- sql - 我可以在我正在构建的视图的 SELECT 语句中以另一列的值为条件创建另一列吗?
- arrays - C 程序生成伪语言 - 全局 3D 数组太大(分段错误)?
- jquery - ASP.NET MVC 5 应用程序 - 如何在 ajax 发布后重定向到 URL?
- scala - EMR 总是给我找不到 Scala 应用程序的类
- python - 复制对象时,是否可以保持身份相同?