打包适用于Mac OS的PyQt5应用程序

时间:2016-04-20 15:35:50

标签: python macos qt pyqt pyqt5

我在尝试将PyQt程序打包为Mac OS应用程序时遇到了问题。

我可以使用cx_Freeze创建应用程序,但是当我打开应用程序时,它会意外退出。在控制台中,它显示错误,即计算机上安装了两个版本Qt,它无法决定使用哪个版本。一个版本在我刚制作的应用程序中,另一个版本在/usr/local/Cellar/qt5/...

我如何解决这个问题?该脚本完全没有打包成应用程序。

修改

添加错误和setup.py

控制台读数:

objc[56464]: Class NotificationReceiver is implemented in both /path/to/the.app/Contents/MacOS/QtWidgets and /usr/local/Cellar/qt5/5.5.1_2/lib/QtWidgets.framework/Versions/5/QtWidgets. One of the two will be used. Which one is undefined.
objc[56464]: Class QCocoaPageLayoutDelegate is implemented in both /path/to/the.app/Contents/MacOS/QtPrintSupport and /usr/local/Cellar/qt5/5.5.1_2/lib/QtPrintSupport.framework/Versions/5/QtPrintSupport. One of the two will be used. Which one is undefined.
objc[56464]: Class QCocoaPrintPanelDelegate is implemented in both /path/to/the.app/Contents/MacOS/QtPrintSupport and /usr/local/Cellar/qt5/5.5.1_2/lib/QtPrintSupport.framework/Versions/5/QtPrintSupport. One of the two will be used. Which one is undefined.

setup.py

from cx_Freeze import setup, Executable
import sys

# Dependencies are automatically detected, but it might need
# fine tuning.
buildOptions = dict(packages=[], excludes=[])

base = 'Win32GUI' if sys.platform == 'win32' else None

executables = [
    Executable('qt_test.py', base=base)
]

setup(
    name='SpamEggs',
    version='0.1',
    description='The Description',
    options=dict(build_exe=buildOptions),
    executables=executables
)

0 个答案:

没有答案