我一直在尝试编译一个使用PyQt5的QtWebEngine的应用程序。该应用程序按预期工作,但在编译时失败。我花了几天时间寻找解决方案,但到目前为止我没有运气。我从brew中安装了python并从它的网站下载了包。我还安装了PyQt5 form brew和pip3而没有任何运气。运行pyinstaller脚本后,我得到“找不到QtWebEngineProcess”错误。通过将QtWebEngineProcess.app文件复制到MacOS文件夹中来解决这个问题。随后我确保info.plist文件不是符号链接而是实际文件。之后,我将“org.qt-project.Qt.QtWebEngineCore”标志添加到主应用程序info.plist中的“CFBundleIdentifier”。这解决了找不到“QtWebEngineProcess”的问题,但它现在带来了下面所述的错误。我也将“icudtl.dat”复制到了MacOS文件夹中。我还尝试用框架本身重建依赖项,并确保我没有符号链接like stated here。我不熟悉install_name_tool所以我被困在那里。有任何想法吗?是否有人能够使用QtWebEngine编译pyqt应用程序?
这是我面临的错误:
[0201/130544:ERROR:icu_util.cc(162)] Invalid file descriptor to ICU data received.
[0201/130544:FATAL:content_main_runner.cc(714)] Check failed: base::i18n::InitializeICU().
0 QtWebEngineCore 0x000000010d4b62e3 _ZN15QtWebEngineCore20FilePickerController11qt_metacallEN11QMetaObject4CallEiPPv + 12132083
1 QtWebEngineCore 0x000000010d4c9809 _ZN15QtWebEngineCore20FilePickerController11qt_metacallEN11QMetaObject4CallEiPPv + 12211225
2 QtWebEngineCore 0x000000010ce7cb03 _ZN15QtWebEngineCore20FilePickerController11qt_metacallEN11QMetaObject4CallEiPPv + 5605139
3 QtWebEngineCore 0x000000010c918ee4 _ZN15QtWebEngineCore18WebContentsAdapter14faviconManagerEv + 28052
4 QtWebEngineCore 0x000000010c917f48 _ZN15QtWebEngineCore18WebContentsAdapter14faviconManagerEv + 24056
5 QtWebEngineCore 0x000000010c90e3b9 _ZN15QtWebEngineCore18WebContentsAdapterC2EPN7content11WebContentsE + 57
6 QtWebEngineWidgets 0x000000011113ce4e _ZrsR11QDataStreamR17QWebEngineHistory + 1870
7 QtWebEngineWidgets 0x000000011113ec20 _ZN14QWebEnginePageC1EP7QObject + 48
8 QtWebEngineWidgets 0x000000011114ad17 _ZN14QWebEngineView6setUrlERK4QUrl + 55
9 PyQt5.QtWebEngineWidgets.so 0x0000000111100ca3 _ZL26meth_QWebEngineView_setUrlP7_objectS0_ + 99
10 Python 0x00000001080faae9 PyCFunction_Call + 233
11 Python 0x0000000108187a81 PyEval_EvalFrameEx + 35729
12 Python 0x00000001081884fc PyEval_EvalFrameEx + 38412
13 Python 0x0000000108188e90 _PyEval_EvalCodeWithName + 2400
14 Python 0x0000000108188f97 PyEval_EvalCodeEx + 71
15 Python 0x00000001080d577a function_call + 186
16 Python 0x00000001080a28d3 PyObject_Call + 99
17 Python 0x00000001080bd9cc method_call + 140
18 Python 0x00000001080a28d3 PyObject_Call + 99
19 Python 0x00000001081184c1 slot_tp_init + 81
20 Python 0x000000010810ef44 type_call + 212
21 Python 0x00000001080a28d3 PyObject_Call + 99
22 Python 0x0000000108182b65 PyEval_EvalFrameEx + 15477
23 Python 0x0000000108188e90 _PyEval_EvalCodeWithName + 2400
24 Python
0x0000000108188ff1 PyEval_EvalCode + 81
25 Sailor 0x0000000106e52490 Sailor + 9360
26 Sailor 0x0000000106e529f9 Sailor + 10745
27 Sailor 0x0000000106e51464 Sailor + 5220
28 ??? 0x0000000000000003 0x0 + 3
Trace/BPT trap: 5
答案 0 :(得分:1)
使用this branch并添加一些custom patching后,它对我有用:
def patch_osx_app():
"""Patch .app to copy missing data and link some libs.
See https://github.com/pyinstaller/pyinstaller/issues/2276
"""
app_path = os.path.join('dist', 'qutebrowser.app')
qtwe_core_dir = os.path.join('.tox', 'pyinstaller', 'lib', 'python3.6',
'site-packages', 'PyQt5', 'Qt', 'lib',
'QtWebengineCore.framework')
# Copy QtWebEngineProcess.app
proc_app = 'QtWebEngineProcess.app'
shutil.copytree(os.path.join(qtwe_core_dir, 'Helpers', proc_app),
os.path.join(app_path, 'Contents', 'MacOS', proc_app))
# Copy resources
for f in glob.glob(os.path.join(qtwe_core_dir, 'Resources', '*')):
dest = os.path.join(app_path, 'Contents', 'Resources')
if os.path.isdir(f):
shutil.copytree(f, os.path.join(dest, f))
else:
shutil.copy(f, dest)
# Link dependencies
for lib in ['QtCore', 'QtWebEngineCore', 'QtQuick', 'QtQml', 'QtNetwork',
'QtGui', 'QtWebChannel', 'QtPositioning']:
dest = os.path.join(app_path, lib + '.framework', 'Versions', '5')
os.makedirs(dest)
os.symlink(os.path.join(os.pardir, os.pardir, os.pardir, 'Contents',
'MacOS', lib),
os.path.join(dest, lib))
答案 1 :(得分:0)
这是QtWebEngine的一些问题。我相信存在补丁来修复这个bug。 您可以在https://github.com/pyinstaller/pyinstaller/issues/2566
中查看其他信息