有人之前提出了类似的问题:https://stackoverflow.com/questions/23600028/py2app-app-crashes-on-earlier-mac-os-x-versions
我的应用程序在我的机器上运行良好(OSX 10.9.4),但是当我将它移动到另一台运行10.7.5的机器上时,应用程序在启动时会崩溃。我在控制台中得到以下信息:
这是我的setup.py文件:
Traceback (most recent call last):
File "/PATH_TO_APP/APP.app/Contents/Resources/__boot__.py", line 3
_recipes_pil_prescript(['Hdf5SubImagePlugin', 'FitsStubImagePlugin', 'SunImagePlugin', 'GbrImagePlugin', 'Jpeg2KImagePlugin', 'MicImagePlugin', 'FpxImagePlugin', ImImagePlugin', ...
File "/PATH_TO_APP/APP.app/Contents/Resources/__boot__.py, line 3
from PIL import Image
File "PIL/Image.pyc", line 62, in <module>
File "PIL/_imaging.pyc", line 14, in <module>
File "PIL/_imaging.pyc", line 10, in __load
ImportError: dlopen(/PATH_TO_APP/APP.app/Contents/Resources/lib/python2.7/lib-dynload/PIL/_imaging.so, 2): Symbol not found: ___sincos_stret
Referenced from /PATH_TO_APP/APP.app/Contents/Resources/lib/python2.7/lib-dynload/PIL/_imaging.so
Expected in: /usr/lib/libSystem.B.dylib
in /PATH_TO_APP/APP.app/Contents/Resources/lib/python2.7/lib-dynload/PIL/_imaging.so
之前,为了解决这个错误,我只是卸载了pillow。我不确定为什么会将pillow库添加到应用程序中,因为我并不认为我在使用它。但现在,在尝试这个解决方法时,我又遇到了另一个错误:
Traceback (most recent call last):
File "/PATH_TO_APP.app/APP.app/Contents/Resources/__boot__.py", line 384, in <module> _recipes_pil_prescript([])
File "/PATH_TO_APP.app/APP.app/Contents/Resources/__boot__.py", line 344, in _recipes_pil_prescript from PIL import Image
File "/usr/local/lib/python2.7/site-packages/PIL/Image.py", line 62, in <module>
ImportError cannot import name _imaging
很显然我现在不知道怎么使用PIL了。我的脚本引入了以下内容:
from __future__ import division
import easygui as eg
import os, zlib, re, datetime, getpass, tkMessageBox, sys
import zipfile as z
import Tkinter as tk
from tkFileDialog import askdirectory
from optparse import OptionParser
这是我的setup.py文件:
from setuptools import setup
APP = ['zipperscript.py']
DATA_FILES = []
OPTIONS = {'argv_emulation': True, 'excludes': ['']}
setup(
app=APP,
name="Zipperscript_HI_50",
data_files=DATA_FILES,
options={'py2app': OPTIONS},
setup_requires=['py2app'],
version="Hawaii branch 4.0.50"
)
我不确定操作系统版本是否导致了问题,但这是我目前的理论。我不知道该怎么继续。非常感谢任何帮助或建议。