如何强制 py2app 以 32 位模式运行应用程序
我正在尝试在 Mac OS X 10.6 上使用 py2app 构建应用程序包。该应用程序使用一些仅针对 32 位编译的库,因此当应用程序运行时,会出现 ImportError“没有合适的 64 位架构”。我如何告诉 py2app 强制应用程序在 32 位模式下运行?
I am trying to build an app bundle with py2app on Mac OS X 10.6. The app uses some libraries which are only compiled for 32-bit, so when the app is run there is an ImportError "no appropriate 64-bit architecture". How can I tell py2app to force the app to run in 32-bit mode?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
如果您只想在 32 位模式下运行,那么您不需要 64 位架构。因此,您可以使用
ditto
实用程序从生成的应用程序包中删除所有非 i386 架构。示例:
您的应用程序包将会更小,并且肯定会作为 32 位应用程序运行,即使在 64 位 Intel 系统上也是如此。
手册:http://developer. apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man1/ditto.1.html
或者只是在终端中运行:
man ditto
If you want to run only in 32 bit mode, then you don't need the 64 bit architecture. So you can just strip out all the non-i386 architectures from your resulting application bundle using the
ditto
utility.Example:
Your application bundle will be smaller and will run as a 32 bit application for sure, even on 64 bit Intel systems.
Manual: http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man1/ditto.1.html
Or just run in a terminal:
man ditto
一种方法是使用仅 32 位的 Python,例如可通过 py2app 从 python.org 下载的仅 32 位版本。另一种方法是在生成的应用程序包的 Info.plist 中将
LSArchitecturePriority
设置为i386
并可能设置为ppc
。请参阅此处了解更多信息信息。One way is to use a 32-bit-only Python, such as the 32-bit-only versions downloadable from python.org, with py2app. Another is to set the
LSArchitecturePriority
toi386
and possiblyppc
in the generated app bundle's Info.plist. See here for more info.经过大量的痛苦并尝试让 wx 工作后,我设法使用这种方法让它工作,我还包括了我安装的版本
这是唯一对我有用的,我希望它对其他人有帮助..
我的看起来有点像这样
我安装了 python2.7
wxPython2.8-osx-unicode-py2.7
setuptools-0.6c11-py2.7.egg
然后
安装了 py2applet 0.6.4 版本
After lots of pain and trying to get wx working I managed to get it to work using this method, I have also included the versions I installed
This was the only one that worked for me, I hope it helps others..
Mine looks a bit like this
I installed python2.7 with
wxPython2.8-osx-unicode-py2.7
setuptools-0.6c11-py2.7.egg
and then
This installed version 0.6.4 of py2applet
好的,鉴于我在 Vebjorn 的一间办公室工作,这可能是发布答案的最佳位置,以便我们再次找到它。给定 py2app 选项字典:
这将为 LSArchitecturePriority 键创建一个由一个字符串值组成的数组。
OK, seeing as I work one office over from Vebjorn, possibly this is the best place to post an answer so we will find it again. Given a dictionary of py2app options:
This creates an array of one string value for the LSArchitecturePriority key.
您需要强制 python 以 32 位模式运行。
You need to force python to run in 32-bit mode.