使用py2app编译64位Mac应用

4 投票
1 回答
1192 浏览
提问于 2025-04-17 04:37

我在我的Mac OS X 10.7上用py2app 0.6.3编译了一个Python屏幕保护程序,但是当我在系统偏好设置中打开这个屏幕保护程序时,出现了以下提示:

你无法在这台电脑上使用Silly Balls屏幕保护程序。

我了解到,这个提示的意思是需要为64位系统编译。

我在64位系统上运行的是64位的Python 2.7.1。

我该如何用py2app编译一个64位的应用程序,让这个屏幕保护程序示例可以正常工作呢?

1 个回答

3

类似这样的内容 - 注意这里的 'LSArchitecturePriority' : 'x86_64',

#cat ./setup.py 
"""
This is a setup.py script generated by py2applet

Usage:
    python setup.py py2app
"""

from setuptools import setup, find_packages

APP = ['YourApp.py']
DATA_FILES = []
OPTIONS = {
    'argv_emulation': False,
    'semi_standalone':'False',
    'optimize': 2,
    'includes': [
        ...
    ],
    'site_packages': 'True',
    'plist' : {
        'LSPrefersPPC' : False,
        'LSArchitecturePriority' : 'x86_64',
    }
}

setup(
    name = "YourApp",
    version = "0.0.4",
    author = "Iam",
    author_email = "info@test.com",
    description = ("An demonstration of how to create, document, and publish MacOS app"),
    app=APP,
    data_files=DATA_FILES,
    options={'py2app': OPTIONS},
    setup_requires=['py2app'],
)

撰写回答