简体   繁体   English

此应用程序无法启动,因为它无法在“”中找到或加载 Qt 平台插件“xcb”

[英]This application failed to start because it could not find or load the Qt platform plugin "xcb" in ""

I have an application which runs using Qt5 (via PyQt).我有一个使用 Qt5(通过 PyQt)运行的应用程序。 I am using miniconda and the python code has been cythonised.我正在使用 miniconda,python 代码已经过 cythonized。 The code was setup on my local machine, the cython code produced from the original .py files and the relevant libraries and modules installed in miniconda such that the code runs successfully.该代码是在我的本地计算机上设置的,由原始.py文件生成的 cython 代码以及安装在 miniconda 中的相关库和模块,以便代码成功运行。 Then I ship everything to another machine, compile the cython code to give .so files and attempt to run it.然后我将所有内容都发送到另一台机器上,编译 cython 代码以提供.so文件并尝试运行它。 At this point I get the error:此时我得到错误:

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

Reinstalling the application may fix this problem.
Aborted (core dumped)

I have looked around for a long time for possible solutions and I have the following extra information:我已经四处寻找可能的解决方案很长时间了,我有以下额外信息:

I have checked ldd on the various .so files.我已经检查了各种.so文件的 ldd 。 All seem to find the required libraries.似乎都找到了所需的库。

I have tried locate libqxcb.so and this returns: ~/miniconda3/pkgs/qt-5.6.2-3/plugins/platforms/libqxcb.so & ~/miniconda3/plugins/platforms/libqxcb.so我尝试locate libqxcb.so并返回: ~/miniconda3/pkgs/qt-5.6.2-3/plugins/platforms/libqxcb.so & ~/miniconda3/plugins/platforms/libqxcb.so

Based on the suggestions here from TranslucentCloud, I have copied this to the directory ~/miniconda3/bin/platforms (newly created).根据 TranslucentCloud 建议,我已将其复制到目录~/miniconda3/bin/platforms (新创建的)。

I have also included export QT_DEBUG_PLUGINS=1 in the script which calls my code.我还在调用我的代码的脚本中包含了export QT_DEBUG_PLUGINS=1 This gives the following output:这给出了以下输出:

QFactoryLoader::QFactoryLoader() checking directory path "~/miniconda3/bin/platforms" ...
QFactoryLoader::QFactoryLoader() looking at "~/miniconda3/bin/platforms/libqxcb.so"
Found metadata in lib ~/miniconda3/bin/platforms/libqxcb.so, metadata=
{
    "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
    "MetaData": {
        "Keys": [
            "xcb"
        ]
    },
    "className": "QXcbIntegrationPlugin",
    "debug": false,
    "version": 329218
}


Got keys from plugin meta data ("xcb")
loaded library "~/miniconda3/bin/platforms/libqxcb.so"
xkbcommon: ERROR: failed to add default include path ~/Programmes/miniconda3/lib
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/ .
QFactoryLoader::QFactoryLoader() checking directory path "~/miniconda3/bin/xcbglintegrations" ...
QFactoryLoader::QFactoryLoader() checking directory path "~/miniconda3/bin/platformthemes" ...
QFactoryLoader::QFactoryLoader() checking directory path "~/miniconda3/bin/platforminputcontexts" ...
QFactoryLoader::QFactoryLoader() checking directory path "~/miniconda3/bin/styles" ...
Fontconfig error: Cannot load default config file
QFactoryLoader::QFactoryLoader() checking directory path "~/miniconda3/bin/accessible" ...
QFactoryLoader::QFactoryLoader() checking directory path "~/miniconda3/bin/accessiblebridge" ...
QXcbConnection: XCB error: 145 (Unknown), sequence: 165, resource id: 0, major code: 139 (Unknown), minor code: 20
QFactoryLoader::QFactoryLoader() checking directory path "~/miniconda3/bin/imageformats" ...
QLibraryPrivate::unload succeeded on "~/miniconda3/bin/platforms/libqxcb.so"

The GUI now loads and buttons etc work. GUI 现在加载和按钮等工作。 However, there are still a few issues - the minor issue is that all the fonts are different from my local machine (not a major problem, but presumably indicative that it's still not finding some relevant libraries).但是,仍然存在一些问题 - 小问题是所有字体都与我的本地机器不同(不是主要问题,但可能表明它仍然没有找到一些相关的库)。

More seriously, the GUI doesn't respond to any key presses - the GUI has lots of text boxes to fill in so this makes it unusable.更严重的是,GUI 不响应任何按键 - GUI 有很多文本框要填写,所以这使它无法使用。

There are clearly some errors still in the output above, however, it's not clear from this which libraries etc. it is still unable to find (or why this is the case).显然,上面的输出中仍然存在一些错误,但是,尚不清楚哪些库等仍然无法找到(或为什么会这样)。

A number of steps were necessary to resolve the errors above:解决上述错误需要一些步骤:

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

Reinstalling the application may fix this problem.
Aborted (core dumped)

This can be resolved by copying ~/miniconda3/plugins/platforms to ~/miniconda3/bin .这可以通过将~/miniconda3/plugins/platforms复制到~/miniconda3/bin来解决。

In addition in the bash script which launches the Qt GUI I have added the following lines, otherwise all the text in the GUI appears in Courier:此外,在启动 Qt GUI 的 bash 脚本中,我添加了以下几行,否则 GUI 中的所有文本都会出现在 Courier 中:

export FONTCONFIG_FILE=/etc/fonts/fonts.conf
export FONTCONFIG_PATH=/etc/fonts/

Finally I also needed the following line to allow keypresses to be registered by the GUI:最后,我还需要以下行来允许 GUI 注册按键:

export QT_XKB_CONFIG_ROOT=/usr/share/X11/xkb

Key to resolving this was the line: export QT_DEBUG_PLUGINS=1 which enabled me to see where Qt was breaking.解决这个问题的关键是这一行: export QT_DEBUG_PLUGINS=1 ,它使我能够看到 Qt 在哪里中断。

sudo apt-get install qt5-default sudo apt-get install qt5-default

It helped me to open shotcut in ubuntu它帮助我在 ubuntu 中打开 shotcut

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Matplotlib 给出此应用程序无法启动,因为它无法在“”中找到或加载 ZE8801102A40AD89DDCFCFDCAEBF008D25Z 平台插件“xcb” - Matplotlib gives This application failed to start because it could not find or load the Qt platform plugin “xcb” in “” 无法找到或加载 Qt 平台插件“xcb” - Could not find or load the Qt platform plugin "xcb" 应用程序启动失败,因为它无法找到或加载 Qt 平台插件“windows” - The application failed too start because it could not find or load the Qt platform plugin ''windows" 从命令行运行 python:应用程序无法启动,因为它无法找到或加载 Qt 平台插件“windows” - running python from command line: application failed to start because it could not find or load the Qt platform plugin “windows” 此应用程序无法启动,因为无法在“”中找到或加载Qt平台插件“ windows” - This application failed to start because it could not find or load the Qt platform plugin “windows” in “” 应用程序无法启动,因为没有可以初始化 Qt 平台插件 - application failed to start because no Qt platform plugin could be initialized 此应用程序启动失败,因为无法初始化 Qt 平台插件 - This application failed to start because no Qt platform plugin could be initialized PyQt5 Designer is not working: This application failed to start because no ZE8801102A40AD89DDCFDCAEBF008D25Z platform plugin could be initialized - PyQt5 Designer is not working: This application failed to start because no Qt platform plugin could be initialized pyqt5:此应用程序无法启动,因为无法初始化 Qt 平台插件 - 安装问题? - pyqt5: This application failed to start because no Qt platform plugin could be initialized - installation problem? pyqt5 此应用程序无法启动,因为没有可以初始化 Qt 平台插件 - pyqt5 This application failed to start because no Qt platform plugin could be initialized
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM