在MacOSX Mavericks上出现PyQt5,Python3和Anaconda3问题

时间:2019-01-15 13:36:52

标签: python-3.x macos pyqt5

我特别想与Mac OSX上使用Python开发的人有反馈。

我开发的应用程序在GNU / Linux和Windows下表现良好(我已经使用PyInstaller在两个系统下创建了该应用程序的可执行文件)。

我已经(使用VirtualBox)虚拟化了OSX Mavericks(更新至版本10.9.5),因为我也想在该系统下分发软件。

我安装了Miniconda(使用Python 3.7.1和...,以及其他模块PyQt5-> pyqt-5.9.2)。我为我的应用程序设置了虚拟环境,访问时无后顾之忧(顺便说一句,Anaconda确实很棒)。

仍然,我在导入QtGui和QtCore时遇到问题(在Mac OSX上QtCore似乎有很大问题):

    (apsc) Mac-Pro-de-angelo:apsc angelo$ python apsc_gui.py
Traceback (most recent call last):
  File "apsc_gui.py", line 11, in <module>
    from moteur_apsc.exec_pdfkit_seq_prof_gui import APSC_Sequence_Prof
  File "/Users/angelo/miniconda3/envs/apsc/moteur_apsc/exec_pdfkit_seq_prof_gui.py", line 27, in <module>
    from affichage_apsc.push_button_icone_droite import PushButtonIconeDroite
  File "/Users/angelo/miniconda3/envs/apsc/affichage_apsc/push_button_icone_droite.py", line 10, in <module>
    from PyQt5.QtCore import Qt
ImportError: dlopen(/Users/angelo/miniconda3/envs/apsc/lib/python3.7/site-packages/PyQt5/QtCore.so, 2): Symbol not found: _LSCopyDefaultApplicationURLForURL
  Referenced from: /Users/angelo/miniconda3/envs/apsc/lib/libQt5Core.5.dylib
  Expected in: /System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices
 in /Users/angelo/miniconda3/envs/apsc/lib/libQt5Core.5.dylib
(apsc) Mac-Pro-de-angelo:apsc angelo$

如果我只是通过终端导入QtGui,则问题是相同的:

Mac-Pro-de-angelo:bin angelo$ conda activate apsc
(apsc) Mac-Pro-de-angelo:bin angelo$ python
Python 3.7.1 (default, Dec 14 2018, 13:28:58) 
[Clang 4.0.1 (tags/RELEASE_401/final)] :: Anaconda custom (64-bit) on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from PyQt5 import QtGui
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: dlopen(/Users/angelo/miniconda3/envs/apsc/lib/python3.7/site-packages/PyQt5/QtGui.so, 2): Symbol not found: _LSCopyDefaultApplicationURLForURL
  Referenced from: /Users/angelo/miniconda3/envs/apsc/lib/libQt5Core.5.dylib
  Expected in: /System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices
 in /Users/angelo/miniconda3/envs/apsc/lib/libQt5Core.5.dylib
>>>

您能帮我解决问题和/或确切地知道发生了什么吗?

预先感谢您可以提供给我的所有帮助。

晚上好。

1 个答案:

答案 0 :(得分:0)

我首先要检查您的LaunchServices是否带有这个符号

nm /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/LaunchServices | grep _LSCopyDefaultApplicationURLForURL

是否有可能使用最新版本的OSX编译了QtGui?