python app - xcb plugin fail

2019-08-08 15:57发布

问题:

My setting: Python 2.7 with anaconda

Recently I have installed OpenCV 3.0 and when I try to do simple image display or I want to run python samples that come with OpenCV, there is a error message:

This application failed to start because it could not find or load the Qt platform plugin "xcb".

I have read many comments that I need to attach .so files to my project but I don't think it's the optimal solution since for most people it works out of a box.

I have no clue what to do. I'm inexperienced. What comes to my mind is only to reinstall everything.

回答1:

Qt5 works fine with OpenCV 3.1.0. This is what worked for me for resolving the "xcb" error.

Apparently the Anaconda qt and pyqt packages (v4) were shadowing the system v5 version.

If you want to work with Qt5 try removing these via:

conda remove qt
conda remove pyqt

(Ubuntu 16.04, OpenCV 3.1.0, Anaconda 4.1.1, Qt 5)



回答2:

Okey, I have figured it out.

During cmake I set flag -D WITH_QT=OFF since I read somewhere that it doesnt work for Qt5.x



回答3:

### pip uninstall matplotlib
### pip install matplotlib

This works for me!