(python + conda => anaconda ) + qt5 + opencv in ubuntu

11 篇文章 0 订阅
9 篇文章 0 订阅

anaconda

problem in ubuntu

  • 需要opencv2 + qt5 + pyqt+python科学环境
  • 先安装了qt5 和 anaconda2(python 科学环境,似乎自带pyqt)
  • 但在编译安装opencv2的时候,不小心使用了系统默认的python2.7
This application failed to start because it could not find or load the Qt platform plugin "xcb"
  • 通过安装miniconda是可以避免这个问题的
  • 然而重装anaconda2,问题无法得到解决
  • finally
export QT_QPA_PLATFORM_PLUGIN_PATH=${QT5_ROOT}/plugins

another problem

Gtk-CRITICAL **: IA__gtk_widget_style_get: assertion 'GTK_IS_WIDGET (widget)' failed
  • in fact, I cannot avoid it, but after change the qt style, the output of above message will be less.
  • If you are lazy enough, you can avoid use cv2.imshow() in python, instead we can use matplotlib or scikit-image.
sudo qtconfig
#or
sudo qtconfig-qt4
  • For I use Qt5, so change the style of qt4 is meaningless. I add this in ~/.bashrc, for more information view qt5 set default style
QT_STYLE_OVERRIDE=adwaita
  • finally, cv.imshow() works right, that’s fun.
In [4]: img=cv2.imread('/home/yzbx/Pictures/shot.png')

In [5]: cv2.imshow('img',img)
init done
opengl support available

In [6]: key=cv2.waitkey(0)

reference

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值