我的 py2app 应用程序无法打开.有什么问题? [英] My py2app app will not open. What's the problem?

查看:65
本文介绍了我的 py2app 应用程序无法打开.有什么问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在用 python、pygame 和 py2app 编写一个简单的游戏.(我使用 python 2.6)当我在别名模式下构建我的游戏时,它工作正常,但是当我为部署而构建时,应用程序在午餐后立即崩溃.有人知道是怎么回事吗?

I'm writing a simple game with python, pygame and py2app. (I use python 2.6) When I build my game in alias mode, it works fine, but when I build for deployment, the app I get crashes immediately after lunching. Anyone know what's going on?

推荐答案

为了对整个问题提供更彻底的答案,我将使用 Aliens.py 示例.在 OS X 中内置时,您会在游戏快速初始化和退出时看到快速闪烁.打开控制台显示类似于

To provide a more thorough answer to this whole issue, I'm going to use the aliens.py example. When built in OS X, you will see quick flash as the game quickly initializes and quits. Opening console reveals an error message similar to

Fatal Python error: (pygame parachute) Segmentation Fault
Job appears to have crashed: Abort trap

我认为问题在于打包过程中未包含默认字体.

I believe the issue is that the default font is not being included during the packaging process.

例如,在aliens.py 示例中,将支持的字体放入数据文件夹并进行更改

In the aliens.py sample for instance, throw a supported font into your data folder and change

self.font = pygame.font.Font( None ), 20)

self.font = pygame.font.Font( os.path.join('data', 'Copperplate.ttc'), 20)

这应该允许应用程序编译和播放没有问题.

This should allow the app to complie and play without issue.

这篇关于我的 py2app 应用程序无法打开.有什么问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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