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

后端 未结 5 1196
我在风中等你
我在风中等你 2021-01-06 10: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 ImportErr

相关标签:
5条回答
  • 2021-01-06 10:26

    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

    0 讨论(0)
  • 2021-01-06 10:29

    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

    0 讨论(0)
  • 2021-01-06 10:39

    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.

    0 讨论(0)
  • 2021-01-06 10:39

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

    0 讨论(0)
  • 2021-01-06 10:42

    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.

    0 讨论(0)
提交回复
热议问题