使用 ubuntu 22.04 时 QTcreator 出现错误

使用 ubuntu 22.04 时 QTcreator 出现错误
Traceback (most recent call last):
  File "/home/123/Documents/untitled1/widget.py", line 6, in <module>
    from PySide6.QtWidgets import QApplication, QWidget
ImportError: /snap/core20/current/lib/x86_64-linux-gnu/libdl.so.2: undefined symbol: _dl_vsym, version GLIBC_PRIVATE
19:45:44: /usr/bin/python3 exited with code 1

代码:此 Python 文件使用以下编码:utf-8

import os
from pathlib import Path
import sys

from PySide6.QtWidgets import QApplication, QWidget
from PySide6.QtCore import QFile
from PySide6.QtUiTools import QUiLoader


class Widget(QWidget):
    def __init__(self, parent=None):
        super().__init__(parent)
        self.load_ui()

    def load_ui(self):
        loader = QUiLoader()
        path = Path(__file__).resolve().parent / "form.ui"
        ui_file = QFile(path)
        ui_file.open(QFile.ReadOnly)
        loader.load(ui_file, self)
        ui_file.close()


if __name__ == "__main__":
    app = QApplication(sys.argv)
    widget = Widget()
    widget.show()
    sys.exit(app.exec())

相关内容