尝试显示图像的时候,python报错:

QFactoryLoader::QFactoryLoader() checking directory path "/home/lazurite/anaconda3/envs/pytorch/bin/platforms" ...
qt.qpa.plugin: Could not find the Qt platform plugin "xcb" in ""
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

[1]    1598 abort      python test/qt_test.py

一开始还以为是qt的问题,于是重装qt,无效,人都麻了。

最后看到一个使用新版本opencv同样报错的博客,说原因是因为opencv的版本问题。

解决办法:

pip install opencv-python==4.2.0.34