您的位置:首页 > 编程语言 > Python开发

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

2016-07-17 23:50 1386 查看

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

official python-opencv install process

opencv-qt5.3+

opencv-qt5 default
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  qt opencv python ubuntu pyqt