编译64位Mac应用程序与py2app应用程序、Mac、py2app

2023-09-08 00:47:38 作者:Past(往事)

我编译一个 Python的屏幕保护程序我使用py2app 0.6.3的Mac OS X 10.7,但是当我在系统preferences打开屏幕保护程序我得到以下信息:

I've compiled a Python screen saver on my Mac OS X 10.7 using py2app 0.6.3, but when I open the screen saver in System Preferences i get the following message:

您不能使用愚蠢的球屏保此计算机上。

You cannot use the Silly Balls screen saver on this computer.

我读过这条消息意味着它需要被编译为64位。

I've read that this message means it needs to be compiled for 64-bit.

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

I'm running Python 2.7.1 64-bit on a 64-bit system.

推荐答案

事情是这样的 - 请注意LSArchitecturePriority':'x86_64的

Something like this - note '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'],
)