问题描述
语言:python==3.8.5
平台:Anaconda==4.9.2
操作系统:Ubuntu 20.10
包:opencv-contrib-python==4.5.1.48
IDE:VS Code 2020
执行 cv2.imshow('Final',src_img)
qt.qpa.xcb: Could not connect to display
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "/home/ubuntu/anaconda3/lib/python3.8/site-packages/cv2/qt/plugins" even though it was found.
This application Failed to start because no Qt platform plugin Could be initialized. Reinstalling the application may fix this problem.
Available platform plugins are: xcb,eglfs,minimal,minimalegl,offscreen,vnc.
Aborted (core dumped)
使用 QT_DEBUG_PLUGIN=1 script.py
执行
QFactoryLoader::QFactoryLoader() looking at "/home/bas/anaconda3/plugins/platforms/libqxcb.so"
Found Metadata in lib /home/bas/anaconda3/plugins/platforms/libqxcb.so,Metadata=
{
"IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3","MetaData": {
"Keys": [
"xcb"
]
},"className": "QXcbIntegrationPlugin","debug": false,"version": 329991
}
Got keys from plugin Meta data ("xcb")
QFactoryLoader::QFactoryLoader() checking directory path "/home/bas/anaconda3/bin/platforms" ...
loaded library "/home/bas/anaconda3/lib/python3.8/site-packages/cv2/qt/plugins/platforms/libqxcb.so"
qt.qpa.xcb: Could not connect to display
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "/home/bas/anaconda3/lib/python3.8/site-packages/cv2/qt/plugins" even though it was found.
This application Failed to start because no Qt platform plugin Could be initialized. Reinstalling the application may fix this problem.
Available platform plugins are: xcb,vnc.
Aborted (core dumped)
仅当我在 vs code 终端中运行脚本时才会出现此问题。该脚本在 ubuntu-terminal 中执行时没有错误。
对此问题的一些帮助将不胜感激。谢谢
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)