2012-12-01 39 views
0

我想要做的是将我用Python 2.7编写的程序(使用pygame)编译为Mac计算机的独立应用程序。我正在使用运行Windows 8而无法访问Mac的PC,因此调整过程非常困难。Py2app keyflag错误CFLAGS

当我从命令提示符运行安装文件时,出现“文本泛滥”(类似于py2exe在编译windows版本时给了我什么)并且程序似乎正常工作。它创建构建和dist文件夹,但dist文件夹没有内容。当查看命令提示符输出时,最后两行是 BASE_CFLAGS = cfg ['CFLAGS'] 关键错误:'CFLAGS' 这似乎在py2app尝试创建应用程序包时发生。

下面是setup.py文件我已经得到了迄今:

""" 
Script for building the example. 

Usage: 
    python setup.py py2app 
""" 
from setuptools import setup 

NAME = 'PetCute Slide Puzzle Test' 
VERSION = '0' 

plist = dict(
    CFBundleIconFile=NAME, 
    CFBundleName=NAME, 
    CFBundleShortVersionString=VERSION, 
    CFBundleGetInfoString=' '.join([NAME, VERSION]), 
    CFBundleExecutable=NAME, 
    CFBundleIdentifier='Py2App and PyGam test', 
) 

setup(
    data_files=['Dog1.jpg', 'Dog2.jpg', 'Dog3.jpg', 'Dog4.jpg', 'Dog5.jp', 'Dog6.jpg', 'Dog7.jpg', 'Dog8.jpg', 'Dog9.jpg', 'Dog10.jpg', 'Dog11.jpg', 'Dog12.jpg', 'Dog13.jpg', 'Dog14.jpg', 'Dog15.jpg', 'Dog16.jpg', 'AYearWithoutRain.ttf'], 
    app=[ 
     dict(script="PetCute_slidepuzzle.py", plist=plist), 
    ], 
    setup_requires=["py2app"], 
) 

的data_files列出了需要与代码捆绑在一起的图片和文本文件。我通过调整alien.py例子来解决这个问题。请让我知道是否需要更多的信息!

回答

0

它在编译过程中可能有错误。我建议你确保你已经安装了Numpy,它需要py2app来编译Pygame程序。

+0

谢谢。我安装了numpy,但仍然有同样的问题。我需要做什么特别的事情来指出py2app到numpy? – user1810455

+0

林不知道,截至目前我也有问题。显然numpy只能处理图形。我在DreamCode上发布了一个问题,现在非常相似,如果我找到一个解决方案,我会让你知道的。 –