Pygame 分发 - 运行时错误 [英] Pygame Distribution - Runtime Error

查看:53
本文介绍了Pygame 分发 - 运行时错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用模块 pygame 使用 Python 编写的 2D 街机游戏出现问题,现在 2 天了,但我找不到解决方案.

I am working on a problem with my 2D arcade game programed with Python using the module pygame for 2 days now and I can't find a solution.

问题是:我想创建一个正确运行我的程序的 Windows 可执行文件.我已经设法创建了一个 .exe 文件,但是我一启动 exe 就收到一个错误:

The problem is: I want to create a Windows Executable File that is running my program correctly. I already managed to create a .exe file, but I get an error as soon as I start the exe:

Runtime Error!
Path\MyGame.exe
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.

我尝试使用每个模块创建 .exe 文件,以便轻松构建一个模块,例如 cx_freezepy2exe、<代码>pyinstaller.最后,我使用了哪一个并不重要,我得到了同样的错误.我已经尝试用另一台 PC 启动 .exe 文件,但失败了.更新了我的 Microsoft Visual C++ Redistributable,没有任何帮助.

I tried to create the .exe file with every module that makes it easy to build one, for example cx_freeze, py2exe, pyinstaller. At the end it doesnt matter which one I have used, I got the same error. I already tried to start the .exe file with another PC, it failed. Updated my Microsoft Visual C++ Redistributable, nothing helped.

所以错误一定出在我的代码中.程序运行正常,但一定有什么东西阻止了我制作一个可以正常工作的 .exe 文件.

So the fault must be somewhere in my code. The program is running correctly, but there must be something that prevents me from making a .exe file that works fine.

代码大约有 1000 行,我知道要求有人检查整个代码太多了,但我希望有人有类似的问题,或者有一些提示为什么会出现此错误并可以帮助我.

The code has around 1000 lines, I know it's too much to ask for someone checking the whole code but I hope someone had a similiar problem to this or have some tips why this error is appearing and can help me.

您可以在此处找到代码.

推荐答案

问题不在于你的代码,问题在于你如何生成 .exe.用 pygame 做到这一点是一个真正的婊子,但通过一些黑客和谷歌你可以做到.

The problem is not your code, the problem is how you generate your .exe. Doing that with pygame is a real bitch, but with some hacking and google'ing you can do it.

这应该会让你开始:http://pygame.org/wiki/Pygame2exe

这篇关于Pygame 分发 - 运行时错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆