使用PyInstaller的MacOSX下PyQt5和可可之间的问题

时间:2019-01-16 22:49:06

标签: python-3.x macos pyqt5 pyinstaller

我安装了OSX Mavericks,以确保正在开发的应用程序可以在该系统上运行。我使用PyInstaller进行编译(使用PYInstaller的构建脚本运行无错误)。

问题是,当我双击可执行文件时,出现此错误:

Last login: Wed Jan 16 22:56:18 on ttys004
Mac-Pro-de-angelo:~ angelo$ /Users/angelo/miniconda3/envs/apsc/apsc_1_0_0_onefile_mac_osx/apsc ; exit;
objc[5125]: Class RunLoopModeTracker is implemented in both /var/folders/t0/s6_p_gn15798z_8m8w5f6vjm0000gn/T/_MEIWgQ7yV/libQt5Core.5.dylib and /Users/angelo/miniconda3/envs/apsc/lib/libQt5Core.5.6.2.dylib. One of the two will be used. Which one is undefined.
objc[5125]: Class NotificationReceiver is implemented in both /var/folders/t0/s6_p_gn15798z_8m8w5f6vjm0000gn/T/_MEIWgQ7yV/libQt5Widgets.5.dylib and /Users/angelo/miniconda3/envs/apsc/lib/libQt5Widgets.5.6.2.dylib. One of the two will be used. Which one is undefined.
objc[5125]: Class QCocoaPageLayoutDelegate is implemented in both /var/folders/t0/s6_p_gn15798z_8m8w5f6vjm0000gn/T/_MEIWgQ7yV/libQt5PrintSupport.5.dylib and /Users/angelo/miniconda3/envs/apsc/lib/libQt5PrintSupport.5.6.2.dylib. One of the two will be used. Which one is undefined.
objc[5125]: Class QCocoaPrintPanelDelegate is implemented in both /var/folders/t0/s6_p_gn15798z_8m8w5f6vjm0000gn/T/_MEIWgQ7yV/libQt5PrintSupport.5.dylib and /Users/angelo/miniconda3/envs/apsc/lib/libQt5PrintSupport.5.6.2.dylib. One of the two will be used. Which one is undefined.
QObject::moveToThread: Current thread (0x7f9362f5b620) is not the object's thread (0x7f93640b2370).
Cannot move to target thread (0x7f9362f5b620)

You might be loading two sets of Qt binaries into the same process. Check that all plugins are compiled against the right Qt binaries. Export DYLD_PRINT_LIBRARIES=1 and check that only one set of binaries are being loaded.
This application failed to start because it could not find or load the Qt platform plugin "cocoa"
in "".

Available platform plugins are: cocoa, minimal, offscreen.

Reinstalling the application may fix this problem.
Abort trap: 6
logout

[Opération terminée]

如果我提到这篇文章:

pyinstaller + pyqt5: could not find or load "cocoa"

我遇到了同样的问题,但是建议的解决方案在我家不起作用。

这就是我的PYInstaller脚本的运行方式:

/Users/angelo/miniconda3/envs/apsc/bin/pyinstaller --clean --windowed --onefile --runtime-tmpdir /var/folders/t0/s6_p_gn15798z_8m8w5f6vjm0000gn/T --icon=logo_apsc_256x256.icns --distpath apsc_1_0_0_onefile_mac_osx --name apsc apsc_gui.py

为了准确起见,当直接从Python启动时,我的软件在MacOSX下可以正常运行。

您能帮我找到解决方法吗?

这些是我的规格:

MacOSX 10.9.5 Miniconda3-3.8.3下的Python 3.4.5,qt-5.6.2,sip-4.18和pyqt-5.6.0

...之后...

我真的很想解决这个问题,已经好几天了...我做不到。

它已经有所发展,但是我仍然有错误,并且在用PyInstaller编译后,我仍然无法在MacOSX下启动我的软件(生成的应用程序)

这就是我所做的:

libpython3.6m.dylib和libpython3.6.dylib之间的符号链接(后者在miniconda3中创建的环境的bin目录中不存在):

ln -s /Users/angelo/miniconda3/envs/test/lib/libpython3.6m.dylib /Users/angelo/miniconda3/envs/test/lib/libpython3.6.dylib

然后我下订单:

export DYLD_PRINT_RPATHS=1

应该指出的是,我发现了自己的错误:

21966 ERROR: Can not find path ./libtbb.dylib (needed by /Users/angelo/miniconda3/envs/test/lib/libmkl_tbb_thread.dylib)

结果要好一些,但我总是发现自己有错误:

    objc[2619]: Class RunLoopModeTracker is implemented in both /private/var/folders/t0/s6_p_gn15798z_8m8w5f6vjm0000gn/T/_MEIqjVaY5/libQt5Core.5.dylib and /Users/angelo/miniconda3/envs/test/lib/libQt5Core.5.6.2.dylib. One of the two will be used. Which one is undefined.
objc[2619]: Class NotificationReceiver is implemented in both /private/var/folders/t0/s6_p_gn15798z_8m8w5f6vjm0000gn/T/_MEIqjVaY5/libQt5Widgets.5.dylib and /Users/angelo/miniconda3/envs/test/lib/libQt5Widgets.5.6.2.dylib. One of the two will be used. Which one is undefined.
QObject::moveToThread: Current thread (0x7ff483848540) is not the object's thread (0x7ff48385ab60).
Cannot move to target thread (0x7ff483848540)

...我无法摆脱。

如果有人可以帮助我,我会很高兴,

请帮助我。

0 个答案:

没有答案