pyside6安装后报错及解决方法

环境

ubuntu 20.04

报错

通过pip安装完后pyside6,使用时报错

1
2
3
4
5
6
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: offscreen, wayland-egl, linuxfb, vkkhrdisplay, minimalegl, minimal, wayland, xcb, eglfs, vnc.

Aborted (core dumped)

解决方法

参考https://blog.csdn.net/LOVEmy134611/article/details/107212845

  1. 修改脚本文件~/.bashrc

    1
    $ vim ~/.bashrc
  2. 在最后加入

    1
    export QT_DEBUG_PLUGINS=1
  3. 保存退出,使配置文件生效

    1
    $ source ~/.bashrc
  4. 再次调用pyside6函数,查看详细报错输出,在最下方找到

    1
    2
    3
    xxx
    libxcb-cursor.so.0: cannot open shared object file: No such file or directory
    xxx
  5. 安装库libxcb-cursor0后,能够正常运行

    1
    sudo apt install libxcb-cursor0

pyside6安装后报错及解决方法
https://sisyphus-99.github.io/2023/08/24/pyside6安装后使用报错/
Author
sisyphus
Posted on
August 24, 2023
Licensed under