开发者

How to force py2app to run app in 32-bit mode

I am trying to build an app bundle with py2app on Mac OS X 10.6. The app uses s开发者_运维知识库ome 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?


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:

ditto --rsrc --arch i386 YourApplication.app YourApplicationStripped.app

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


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 to i386 and possibly ppc in the generated app bundle's Info.plist. See here for more info.


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..

py2applet --arch=i386 -i (includes here) --make-setup (pythonfiles, icon)

Mine looks a bit like this

py2applet --arch=i386 -i wx, platform --make-setup print.py print.icns convert.py

I installed python2.7 with
wxPython2.8-osx-unicode-py2.7
setuptools-0.6c11-py2.7.egg
and then

sudo easy_install-2.7 py2app

This installed version 0.6.4 of py2applet


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:

options = {}
...
options['plist'] = { "LSArchitecturePriority": [ "i386" ] }
...
setup(options={'py2app':options})

This creates an array of one string value for the LSArchitecturePriority key.


You need to force python to run in 32-bit mode.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜