降落伞分段错误 - pygame 到 py2exe [英] Parachute Segmentation Fault Error - pygame to py2exe

查看:81
本文介绍了降落伞分段错误 - pygame 到 py2exe的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 GUI2Exe 将我的 python/pygame、游戏编译为 .exe

我的字体模块有问题.

使用 python 2.7 和 GUI2Exe 中的 py2exe 选项我已经用 2.7 版本更新了 python、pygame 和 py2exe.我的程序运行良好,但在我用 py2exe 编译后,我得到了这个.

这是我得到的错误:

Fatal Python error: (pygame parachute) Segmentation Fault此应用程序已请求运行时以一种不寻常的方式终止它.请联系应用程序的支持团队了解更多信息.

我的游戏从控制台开始,然后运行该部分.但是一旦显示开始,我就会崩溃.

谢谢

解决方案

有类似的问题,也有.找到了解决它们的方法:

几周后(甚至之前遇到过这个问题)我很高兴地说我解决了这个问题!:)

我的问题的第一部分(http://i.stack.imgur.com/WpkjR.png):我通过编辑 setup.py 脚本并在其中添加排除"部分来解决它.这导致成功制作可执行文件!

修改的 setup.py 脚本:

from distutils.core 导入设置导入py2exe设置(windows=['source_static.py'],选项={py2exe":{排除":[OpenGL.GL"、数字"、copyreg"、itertools.imap"、numpy"、pkg_resources"、队列"、winreg"、pygame.SRCALPHA"、pygame.sdlmain_osx"],}})

因此,如果您有类似的问题,只需将那些缺失"的模块放入此排除"行中即可.

第二部分:

在我成功制作可执行文件后,我遇到了下一个问题:"应用程序以异常方式请求运行时终止它.请联系...".经过几天的搜索和思考如何解决另一个问题,我找到了一种方法.我简直不敢相信这个问题如此荒谬.问题出在我的代码中,带有字体定义:

font1 = pygame.font.SysFont(None, 13)

在将None"更改为某个系统字体名称(例如Arial"(必须是字符串))并编译后,我简直不敢相信我的 .exe 文件有效!

font1 = pygame.font.SysFont("Arial", 13)

当然,您可以使用自己的字体,但必须指定其路径并在您的程序中定义.

因此,对于遇到此问题的所有人,请尝试以下步骤,希望您能成功.我真的希望这会帮助你,因为我已经失去了几天和几周的时间来试图解决这些问题.我什至尝试使用所有版本的 python 和 pygame 以及许多其他 .exe 构建器和安装脚本制作我的 .exe 文件,但没有运气.除了这些问题,我之前还有很多其他问题,但我在 stackoverflow.com 上找到了答案.

很高兴我找到了解决这些问题的方法,并在您遇到相同问题时为您提供帮助.

小技巧(我也做过):

<块引用><块引用>

第一个:将您的 Microsoft Visual C++ 库更新到最新版本.

2nd:如果您有可执行程序需要的类似图像或字体,请将它们包含到 dist 文件夹(已创建 .exe 文件的位置).

第三:在制作 .exe 文件时,将所有需要的文件包含到 setup.py 脚本所在的文件夹中(主脚本使用的所有文件和目录).

使用 Python 2.7 x64pygamepy2exe.

I am using GUI2Exe to compile my python/pygame, game to a .exe

I have a problem with the font module.

using python 2.7 and the py2exe option in GUI2Exe I have updated python, pygame and py2exe with the 2.7 versions. My program runs fine but after I compile it with py2exe I get this.

Here is the error I get:

Fatal Python error: (pygame parachute) Segmentation Fault

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.

My game starts off as a console and that part runs. But as soon as the display starts I get the crash.

Thanks

解决方案

Had similar problems and that one too. Found a way to solve them:

After few weeks (had this problem even before) I'm happy to say that I solved this problem! :)

1st part of my problem (http://i.stack.imgur.com/WpkjR.png): I solved it by editing setup.py script with adding "excludes" part in it. That resulted in successful making of executable file!

Modified setup.py script:

from distutils.core import setup
import py2exe
setup(windows=['source_static.py'], options={
          "py2exe": {
              "excludes": ["OpenGL.GL", "Numeric", "copyreg", "itertools.imap", "numpy", "pkg_resources", "queue", "winreg", "pygame.SRCALPHA", "pygame.sdlmain_osx"],
              }
          }
      )

So, if you have similar issues, just put those "missing" modules into this "excludes" line.

2nd part:

After I succeeded in making of executable file, I had next problem: "The application has requested the Runtime to terminate it in unusual way. Please contact...". After days and days of searching and thinking how to solve this another problem, I found a way to do it. I couldn't believe that the problem was so absurd. The problem was in my code, with font definition:

font1 = pygame.font.SysFont(None, 13)

After changing "None" to some system font name (for an example "Arial" (must be a string)), and compiling, I couldn't believe that my .exe file worked!

font1 = pygame.font.SysFont("Arial", 13)

Of course, you can use your own font, but you must specify its path and define it in your program.

So for all of you who are experiencing this issues, try this steps and I hope that you will succeed. I really hope that this will help you, because I've lost days and weeks trying to solve these problems. I even tried making my .exe file with all versions of python and pygame, with many other .exe builders and setup scripts, but without luck. Besides these problems, I had many other problems before but I found answers to them on stackoverflow.com.

I'm happy that I found a way to solve this problems and to help you if you are faced with the same ones.

Small tips (things I've also done):

1st: update your Microsoft Visual C++ library to the latest one.

2nd: if you have images or fonts similar that your executable program needs, include them to dist folder (where your .exe file has been created).

3rd: when you are making your .exe file, include all needed files to the folder where your setup.py script is (all files and directories that your main script uses).

Used Python 2.7 x64, pygame and py2exe.

这篇关于降落伞分段错误 - pygame 到 py2exe的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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