之前有人问过类似的问题:https://stackoverflow.com/questions/23600028/py2app-app-crashes-on-earlier-mac-os-x-versions
我的应用程序在我的机器上运行正常(OSX 10.9.4),但当我将其移动到运行10.7.5的另一台机器时,应用程序在启动时崩溃。我在控制台中收到以下消息:
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
早些时候,为了解决这个错误,我只是卸载了枕头。我不确定为什么枕头库会被添加到应用程序中,因为我没想到我正在使用它。但现在,在尝试此解决方法时,我收到另一个错误:
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"
)
我不确定操作系统版本是否会导致问题,但这是我现在的理论。我不知道该怎么办。非常感谢任何帮助或建议。
答案 0 :(得分:0)
在Mac OS 10.8.5上使用扩展时遇到了类似的问题。似乎Pypi上可用的预编译软件包已在OS X的较新版本上进行了编译,不幸的是在较旧的版本上未进行充分的测试。
解决方案是从源头安装枕头。下载源代码,然后运行pip install your_downloaded_file。您可能需要事先安装诸如libjpeg和zlib之类的依赖项。
完成此操作后,我不再遇到错误,并且安装了枕头版本5.4.0。