簡體   English   中英

Python3:導入錯誤:/lib/x86_64-linux-gnu/libQt5Core.so.5:未找到版本“Qt_5.15”

[英]Python3: ImportError: /lib/x86_64-linux-gnu/libQt5Core.so.5: version `Qt_5.15' not found

我使用 Qt Designer 在 Qt 上創建了一個窗口,當我啟動該應用程序時 - 我收到了 ImportError。 感覺這個庫沒有安裝在我的系統中。 但預覽在 Qt Designer 中有效。

設計文件的完整代碼:

# -*- coding: utf-8 -*-

# Form implementation generated from reading ui file 'map.ui'
#
# Created by: PyQt5 UI code generator 5.15.0
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again.  Do not edit this file unless you know what you are doing.


from PyQt5 import QtCore, QtGui, QtWidgets


class Ui_Form(object):
    def setupUi(self, Form):
        Form.setObjectName("Form")
        Form.resize(576, 616)
        self.horizontalLayout = QtWidgets.QHBoxLayout(Form)
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.webView = QtWebEngineWidgets.QWebView(Form)
        self.webView.setUrl(QtCore.QUrl("https://www.openstreetmap.org/"))
        self.webView.setRenderHints(QtGui.QPainter.Antialiasing|QtGui.QPainter.SmoothPixmapTransform|QtGui.QPainter.TextAntialiasing)
        self.webView.setObjectName("webView")
        self.horizontalLayout.addWidget(self.webView)

        self.retranslateUi(Form)
        QtCore.QMetaObject.connectSlotsByName(Form)

    def retranslateUi(self, Form):
        _translate = QtCore.QCoreApplication.translate
        Form.setWindowTitle(_translate("Form", "VasMaps"))
        
from PyQt5 import QtWebEngineWidgets

錯誤日志:

Traceback (most recent call last):
  File "Qt/map.py", line 31, in <module>
    from PyQt5 import QtWebEngineWidgets
ImportError: /lib/x86_64-linux-gnu/libQt5Core.so.5: version `Qt_5.15' not found (required by /usr/local/lib/python3.8/dist-packages/PyQt5/QtWebEngineWidgets.abi3.so)

PyQtWebEngine 包是通過 pip 安裝的。

我嘗試卸載pyqt5並重新安裝,有用!

在 pycharm 終端中:

pip3 uninstall PyQt5

在 ubuntu 終端中:

sudo apt-get install python3-pyqt5

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM