首页 > 解决方案 > PyQGis 与 QWebEngineView 崩溃

问题描述

我安装了 QGIS 3.16.3-Hannover 和 Qt 5.11.2 和 64 位 Windows 10。在另外两台计算机上,我也在类似的条件下安装了它。

我正在将 PyQgis 用于 Qgis 的独立应用程序,我认为 PyQgis 中有些东西不能很好地工作,因为我不能使用 QWebEngineView 和 QWebKit 是的。

我的症状是:

1.-如果在安装了Qgis的QtDesigner中,我在设计中添加了QWebEngineView小部件,程序直接crash并停止运行。

2.- 如果在独立应用程序中我启动 QWebEngineView 它会给我一个错误:

代码:

from qgis.PyQt.QtWidgets import QWidget, QApplication, QMainWindow, QFileDialog
from PyQt5.QtWebEngineWidgets import QWebEngineView

import sys

class temp (QWebEngineView):
    def __init __ (self):
        super () .__ init __ ()

if __name__ == '__main__':
    # We create the instance of the created class and show the window on the screen
    app = QApplication (sys.argv)
    win = temp ()
    win.show ()
    sys.exit (app.exec_ ())

它给出的错误是:

Qt WebEngine ICU data not found at C: /OSGeo4W64/apps/Qt5/resources.Trying parent directory ...
Qt WebEngine ICU data not found at C: / OSGeo4W64 / apps / Qt5. Trying application directory ...
Qt WebEngine ICU data not found at C: / OSGeo4W64 / apps / Python37. Trying fallback directory ... The application MAY NOT work. Installed
Qt WebEngine locales directory not found at location C: / OSGeo4W64 / apps / Qt5 / translationss \ qtwebengine_locales. Trying application directory ...
Qt WebEngine locales directory not found at location C: / OSGeo4W64 / apps / Python37 \ qtwebengine_locales. Trying fallback directory ... Translations MAY NOT not be correct.
[0205 / 214808.373: ERROR: icu_util.cc (179)] Invalid file descriptor to
ICU data received. 
[0205 / 214808.491: FATAL: icu_util.cc (311)] Check failed: result. Backtrace:

我看过这个链接:

https://issues.qgis.org/issues/18155 3年前看来这个错误无法解决...

然后与其他:

https://forum.qt.io/topic/70457/qt-5-7-qtwebenginewidgets-not-working-on-linux/3

我的安装中似乎缺少以下文件夹,其中包括:资源、qtwebengine_locales、...

我已经使用 OsGeo4W 设置卸载了 qwebengine。然后我重新安装了它。

我看到QGis使用5.10.1版本,我尝试通过pip install安装它,但它告诉我只有5.12的版本。

我认为它一定是 QWebEngineView 没有与 Qgis 正确安装。因为如果我将它与 python38 或 python 39 的安装一起使用,那么它是否有效。

标签: pythonpyqt5qwebengineviewpyqgis

解决方案


推荐阅读