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

xriantvc  于 2023-08-03  发布在  Linux
关注(0)|答案(3)|浏览(227)

我用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安装。

mzmfm0qo

mzmfm0qo1#

我试着卸载pyqt 5并重新安装它,它是有用的!
在pycharm终端中:

pip3 uninstall PyQt5

字符串
在Ubuntu终端中:

sudo apt-get install python3-pyqt5

nzrxty8p

nzrxty8p2#

试试这个:
1.查找libQtCore版本

$ ls /lib/x86_64-linux-gnu/libQt5Core.so*
/lib/x86_64-linux-gnu/libQt5Core.so
/lib/x86_64-linux-gnu/libQt5Core.so.5
/lib/x86_64-linux-gnu/libQt5Core.so.5.12
/lib/x86_64-linux-gnu/libQt5Core.so.5.12.8

字符串
1.卸载当前的pyqt5

$ pip3 uninstall pyqt5


1.安装正确版本

$ pip3 install pyqt5==5.12

xuo3flqw

xuo3flqw3#

以上的方法都没有帮助到我。有帮助的是用默认的python 3.11破坏了anaconda环境,用python=3.8创建了一个新的环境,并用pip安装了pyqt5。

相关问题