我用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安装。
3条答案
按热度按时间mzmfm0qo1#
我试着卸载pyqt 5并重新安装它,它是有用的!
在pycharm终端中:
字符串
在Ubuntu终端中:
型
nzrxty8p2#
试试这个:
1.查找libQtCore版本
字符串
1.卸载当前的pyqt5
型
1.安装正确版本
型
xuo3flqw3#
以上的方法都没有帮助到我。有帮助的是用默认的python 3.11破坏了anaconda环境,用
python=3.8
创建了一个新的环境,并用pip安装了pyqt5。