gpt4 book ai didi

python - 在 Ubuntu 中运行 OpenCV python 应用程序时 Qt 链接错误

转载 作者:太空宇宙 更新时间:2023-11-03 22:38:28 27 4
gpt4 key购买 nike

我正在运行 4.1.0 和 python 3.7.3。我使用 conda 安装了 opencv:

conda install -c conda-forge opencv

我没有任何使用 Qt 的经验。我只是想使用 OpenCV imshow 方法显示图像或视频:

cv.imshow('Result (Press any key to exit)', img)
cv.waitKey(0)
cv.destroyAllWindows()

但是当我运行这个程序时,我得到这个错误:

xkbcommon: ERROR: failed to add default include path 
Qt: Failed to create XKB context!
Use QT_XKB_CONFIG_ROOT environmental variable to provide an additional search path, add ':' as separator to provide several search paths and/or make sure that XKB configuration data directory contains recent enough contents, to update please see http://cgit.freedesktop.org/xkeyboard-config/ .

程序继续正常运行。但是 cv.waitKey(0) 不工作。我阅读了关于设置环境变量的内容,但我打算使用 pyinstaller 捆绑这个程序,所以我不能永远依赖这个修复。

是否有永久修复?

最佳答案

此处引用了问题:https://github.com/conda-forge/qt-feedstock/issues/104 .修复已合并到 master 中。

对于 Ubuntu,您可以更新 Qt 来修复此问题:

conda install -c conda-forge qt

qt 5.9.7-h52cfd70_1 --> 5.9.7-h52cfd70_2

关于python - 在 Ubuntu 中运行 OpenCV python 应用程序时 Qt 链接错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56318820/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com