libxcb-xinerama.so.0: cannot open shared object file: No such file or directory

今天在ubutnu 18.04上装了mayavi, 但是写代码可视化点云的时候出现了下面的情况:

QLibraryPrivate::loadPlugin failed on "/home/eric/anaconda3/envs/pointnet/lib/python3.6/site-packages/PyQt5/Qt/plugins/platforms/libqxcb.so" : "Cannot load library /home/eric/anaconda3/envs/pointnet/lib/python3.6/site-packages/PyQt5/Qt/plugins/platforms/libqxcb.so: (libxcb-xinerama.so.0: cannot open shared object file: No such file or directory)"
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.

[1]    17841 abort (core dumped)  python show_points.py

好象是与Pyqt5有关,可视化代码为:

import mayavi.mlab
import torch
import numpy as np

mypointcloud=np.fromfile("/media/eric/My Passport/kitti/training/velodyne/003673.bin",dtype=np.float32,count=-1).reshape([-1,4])
mypointcloud=torch.from_numpy(mypointcloud)
print(mypointcloud.size())
print(mypointcloud.type())

def viz_mayavi(points,vals="distance"):
    x=points[:,0]
    y=points[:,1]
    z=points[:,2]
    r=points[:,3]
    d=torch.sqrt(x**2+y**2)

    if vals=="height":
        col=z
    else:
        col=d

    fig=mayavi.mlab.figure(bgcolor=(0,0,0),size=(1280,720))
    mayavi.mlab.points3d(x,y,z,
                         col,
                         mode="point",
                         colormap='spectral',
                         figure=fig,
                         )

    mayavi.mlab.show()

if __name__=="__main__":
    viz_mayavi(mypointcloud,vals="height")

 

解决方法

 export QT_DEBUG_PLUGINS=1
sudo apt install --reinstall libxcb-xinerama0

重新运行python程序就行了

参考文献

[1].Install fails with ubuntu repository. https://github.com/i3/i3/issues/3252

[2].Ubuntu18.04下Qt出现qt.qpa.plugin:Could not load the Qt platform plugin “xcb“错误怎么办. https://m.yisu.com/zixun/310371.html

 

  • 6
    点赞
  • 16
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

农民小飞侠

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值