我有一个小应用程序,我正在尝试与py2app捆绑。起初我遇到了一个问题,PySide捆绑后没有正确链接,但我通过在最终版本的容器中将sys.path.insert(0, os.path.join(os.getcwd(), 'lib', 'python2.6','lib-dynload'))
添加到__boot__.py
来修复(至少在本地)。
一旦构建完成,它在我的计算机上运行良好。不幸的是,尝试在另一台计算机上运行它会导致:
Traceback (most recent call last):
File "/Volumes/code/dailies/dist/Sequence Dailies.app/Contents/Resources/__boot__.py", line 32, in <module>
_run('dailies_v04.py')
File "/Volumes/code/dailies/dist/Sequence Dailies.app/Contents/Resources/__boot__.py", line 29, in _run
execfile(path, globals(), globals())
File "/Volumes/code/dailies/dist/Sequence Dailies.app/Contents/Resources/dailies_v04.py", line 9, in <module>
from PySide.QtCore import *
File "PySide/__init__.pyc", line 2, in <module>
File "PySide/private.pyc", line 2, in <module>
File "PySide/QtCore.pyc", line 18, in <module>
File "PySide/QtCore.pyc", line 11, in __load
ImportError: dlopen(/Volumes/code/dailies/dist/Sequence Dailies.app/Contents/Resources/lib/python2.6/lib-dynload/PySide/QtCore.so, 2): Library not loaded: libpyside-python2.6.1.0.dylib
Referenced from: /Volumes/code/dailies/dist/Sequence Dailies.app/Contents/Resources/lib/python2.6/lib-dynload/PySide/QtCore.so
Reason: image not found
是否有一个额外的步骤我错过了正确链接PySide?这是我的(无趣的)setup.py
:
from setuptools import setup
APP = ['dailies_v04.py']
DATA_FILES = []
OPTIONS = {'argv_emulation': False}
setup(
app=APP,
data_files=DATA_FILES,
options={'py2app': OPTIONS},
setup_requires=['py2app'],
)
答案 0 :(得分:0)
在options
中,您应该添加
'includes': 'PySide'
如果这不起作用,有时我会发现在安装脚本帮助的顶部导入所需的模块。
所以改变:
from setuptools import setup
到
from setuptools import setup
import PySide