简体   繁体   English

降落伞分割错误-pygame到py2exe

[英]Parachute Segmentation Fault Error - pygame to py2exe

I am using GUI2Exe to compile my python/pygame, game to a .exe 我正在使用GUI2Exe将我的python / pygame,游戏编译为.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. 使用python 2.7和GUI2Exe中的py2exe选项,我已经用2.7版本更新了python,pygame和py2exe。 My program runs fine but after I compile it with py2exe I get this. 我的程序运行正常,但是用py2exe编译后,我得到了。

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. 问题的第一部分http://i.stack.imgur.com/WpkjR.png ):我通过编辑setup.py脚本并在其中添加“排除”部分来解决了该问题。 That resulted in successful making of executable file! 这样就成功地制作了可执行文件!

Modified setup.py script: 修改的setup.py脚本:

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! 在将“ None ”更改为某些系统字体名称(例如,“ Arial”(必须是字符串))并进行编译后,我不敢相信我的.exe文件有效!

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. 我什至尝试使用所有版本的python和pygame以及许多其他.exe构建器和设置脚本来制作.exe文件,但是没有运气。 Besides these problems, I had many other problems before but I found answers to them on stackoverflow.com. 除了这些问题,我之前还有很多其他问题,但是我在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. 第一:将您的Microsoft Visual C ++库更新到最新的。

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). 第二:如果您的图像或字体与可执行程序所需的图像或字体相似,请将它们包括到dist文件夹(已创建.exe文件的位置)中。

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). 第三:制作.exe文件时,请将所有需要的文件包括到setup.py脚本所在的文件夹中(主脚本使用的所有文件和目录)。

Used Python 2.7 x64 , pygame and py2exe . 使用Python 2.7 x64pygamepy2exe

Don't use gui2exe use this file from this link: http://pygame.org/wiki/Pygame2exe 不要使用gui2exe,请通过以下链接使用此文件: http ://pygame.org/wiki/Pygame2exe

Follow the instructions and modify the file as needed. 按照说明进行操作,并根据需要修改文件。 Place the file in the same directory as the "game" main and run the file from console. 将文件放置在与“游戏”主目录相同的目录中,然后从控制台运行文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM