Ubuntu16.04下解决This application failed to start because no Qt platform plugin could be initialized问

在使用python3.7+pycharm+pyqt5运行测试用例时出现以下错误:

    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, xcb.

    Aborted (core dumped)

在网上找了很多解决方法,最终参照这篇博客解决问题:链接: 解决方法.
具体操作如下:
1.修改配置文件:

sudo gedit ~/.bashrc

2.在最末尾添加如下语句并保存,在运行测试用例的时候会列出详细的错误提示:

export QT_DEBUG_PLUGINS=1

3.最终发现是Qt动态链接库的问题,错误提示不存在libxcb-xinerama.so.0库。安装libxcb-xinerama库:

#如果还存在其他依赖库没有安装,也一并安装。
$ sudo apt-get install libxcb-xinerama0

4.再次运行测试用例,可以成功打开qt。

  • 6
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值