在_qt.so中找不到Py2app PyQt4符号

时间:2017-04-21 16:08:32

标签: python macos pyqt4 py2app

我正在使用Py2app构建OSX Sierra应用程序。构建完成没有任何问题,在构建PC上应用程序启动没有任何问题。当我将它移植到目标系统(相同的osx版本)时,程序不会运行。它说ImportError: dlopen(...PyQt4/_qt.so) Symbol not found

有人可能会猜到有些东西丢失了,但我不知道在哪里看。 QDataStream似乎是QtCore的一部分,QtCore肯定包括在内。它产生的完整错误是:

Traceback (most recent call last):
  File "/Users/Work/Desktop/MyApp.app/Contents/Resources/__boot__.py", line 81, in <module>
    _run()
  File "/Users/Work/Desktop/MyApp.app/Contents/Resources/__boot__.py", line 66, in _run
    exec(compile(source, path, 'exec'), globals(), globals())
  File "/Users/Work/Desktop/MyApp.app/Contents/Resources/MyApp.py", line 7, in <module>
    from PyQt4 import QtGui
  File "PyQt4/QtGui.pyc", line 14, in <module>
  File "PyQt4/QtGui.pyc", line 10, in __load
  File "PyQt4/_qt.pyc", line 14, in <module>
  File "PyQt4/_qt.pyc", line 10, in __load
ImportError: dlopen(/Users/Work/Desktop/MyApp.app/Contents/Resources/lib/python2.7/lib-dynload/PyQt4/_qt.so, 2): Symbol not found: __ZN11QDataStreamC1EP10QByteArrayi
  Referenced from: /Users/Work/Desktop/MyApp.app/Contents/MacOS/../Frameworks/QtGui.framework/Versions/4/QtGui
  Expected in: /Library/Frameworks/QtCore.framework/Versions/4/QtCore
 in /Users/Work/Desktop/MyApp.app/Contents/MacOS/../Frameworks/QtGui.framework/Versions/4/QtGui
2017-04-21 17:46:55.983 MyApp[44290:6824335] MyApp Error

我在setup.py中包含sip以确定。我也尝试了包含'PyQt4', 'paramiko',但这也没有帮助。 setup.py:

from setuptools import setup

APP = ['/Users/username/Desktop/MyApp/MyApp.py']
DATA_FILES = ['/Users/username/Desktop/MyApp/icons']
OPTIONS = {'includes': ['sip', 'PyQt4.QtCore', 'PyQt4.Qt', 'PyQt4.QtGui', 'paramiko'],
           'excludes': ['PyQt4.QtDesigner', 'PyQt4.QtNetwork', 'PyQt4.QtOpenGL', 'PyQt4.QtScript', 'PyQt4.QtSql', 'PyQt4.QtTest', 'PyQt4.QtWebKit', 'PyQt4.QtXml', 'PyQt4.phonon'],
           'iconfile':'/Users/username/Desktop/MyApp/icons/icon.icns'}

setup(
    app=APP,
    data_files=DATA_FILES,
    options={'py2app': OPTIONS},
    setup_requires=['py2app'],
)

0 个答案:

没有答案