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

流过昼夜 提交于 2019-11-30 18:15:24

问题


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?


回答1:


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.




回答2:


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




回答3:


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




回答4:


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.




回答5:


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



来源:https://stackoverflow.com/questions/7472301/how-to-force-py2app-to-run-app-in-32-bit-mode

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!