QT-Could not load the Qt platform plugin ''xcb" in xxx even though it was found. 解决
文章目录
1. 杂话
大伙儿应该都用过PyQT这个玩意吧,基本上来说,是用pytho写前端最方便,做多见的一个库函数了。但是呢,今天我就遇到了一个问题,Could not load the Qt platform plugin ''xcb" in “/xxxxx/envs/SAM2/lib/python3.12/site-packages/cv2/qt/plugins” even though it was found. ,这个地方j加粗的xxx是你自己的python环境。仔细一看,这个错还挺搞笑的啊,就是告诉你找到了,但是我就是load不了他。。。
而且,更加诡异的是,这个错居然还是opencv里面报出来的,你说这不是胡闹吗。。。。anyway,根据我一顿摸爬滚打的探索,终于找到了一个最方便的解决这个问题的方法。
2. 问题
Could not load the Qt platform plugin ''xcb" in "/xxxxx/envs/SAM2/lib/python3.12/site-packages/cv2/qt/plugins" even though it was found.
这个报错通常与 Qt 库的配置或依赖项的问题有关,尤其是在使用 OpenCV 和 PyQt 时。如果你在一个虚拟环境中运行代码,或者使用了不同版本的依赖库,可能会导致 Qt 平台插件加载失败。
3. 解决
首先呢,这里给出