在 Debian 上使用 PySide2 会导致警告:在 Gnome 上忽略 XDG_SESSION_TYPE=wayland

Using PySide2 on Debian causes warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome

我有一个学校项目要做,使用 Python。我必须做一个 GUI,所以我选择通过 PySide2 使用 Qt。 在 Windows 上,一切 运行 都没有问题。 但是当我尝试 运行 我在 Debian 上的项目时,我遇到了这个问题:

Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.
No protocol specified
qt.qpa.xcb: could not connect to display :0
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, webgl, xcb.

我在 Internet 上搜索了一个解决方案,但没有任何效果。 我在 Debian 10 上使用 Python3.7 和 PySide2(与 pip 一起安装)。

尝试在终端中通过 运行 安装 libxcb-xinerama0:
sudo apt-get install libxcb-xinerama0

这解决了我的问题。它只是失踪了。
告诉我!