此应用程序无法启动,因为它无法在“”中找到或加载 Qt 平台插件 "xcb"
This application failed to start because it could not find or load the Qt platform plugin "xcb" in ""
我有一个 运行 使用 Qt5(通过 PyQt)的应用程序。我正在使用 miniconda,python 代码已被 cythonised。代码是在我的本地机器上设置的,从原始 .py
文件生成的 cython 代码以及安装在 miniconda 中的相关库和模块使得代码 运行s 成功。然后我将所有东西都运送到另一台机器上,编译 cython 代码以提供 .so
文件并尝试 运行 它。此时我得到错误:
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)
我已经寻找了很长时间可能的解决方案,并且我有以下额外信息:
我检查了各种 .so
文件的 ldd。似乎都找到了所需的库。
我试过 locate libqxcb.so
和这个 returns:
~/miniconda3/pkgs/qt-5.6.2-3/plugins/platforms/libqxcb.so
&
~/miniconda3/plugins/platforms/libqxcb.so
根据 TranslucentCloud 的建议 here,我已将其复制到目录 ~/miniconda3/bin/platforms
(新创建)。
我还在调用我的代码的脚本中包含了 export QT_DEBUG_PLUGINS=1
。这给出了以下输出:
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"
现在可以加载 GUI 和按钮等。但是,仍然存在一些问题 - 小问题是所有字体都与我本地机器不同(不是主要问题,但可能表明它仍然没有找到一些相关的库)。
更严重的是,GUI 不响应任何按键操作 - GUI 有很多文本框需要填写,因此无法使用。
上面的输出中显然仍然存在一些错误,但是,从中不清楚哪些库等仍然无法找到(或者为什么会这样)。
解决上述错误需要一些步骤:
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)
这可以通过将 ~/miniconda3/plugins/platforms
复制到 ~/miniconda3/bin
来解决。
此外,在启动 Qt GUI 的 bash 脚本中,我添加了以下行,否则 GUI 中的所有文本都会出现在 Courier 中:
export FONTCONFIG_FILE=/etc/fonts/fonts.conf
export FONTCONFIG_PATH=/etc/fonts/
最后我还需要以下行来允许 GUI 注册按键:
export QT_XKB_CONFIG_ROOT=/usr/share/X11/xkb
解决这个问题的关键是:
export QT_DEBUG_PLUGINS=1
这使我能够看到 Qt 哪里出了问题。
我有一个 运行 使用 Qt5(通过 PyQt)的应用程序。我正在使用 miniconda,python 代码已被 cythonised。代码是在我的本地机器上设置的,从原始 .py
文件生成的 cython 代码以及安装在 miniconda 中的相关库和模块使得代码 运行s 成功。然后我将所有东西都运送到另一台机器上,编译 cython 代码以提供 .so
文件并尝试 运行 它。此时我得到错误:
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)
我已经寻找了很长时间可能的解决方案,并且我有以下额外信息:
我检查了各种 .so
文件的 ldd。似乎都找到了所需的库。
我试过 locate libqxcb.so
和这个 returns:
~/miniconda3/pkgs/qt-5.6.2-3/plugins/platforms/libqxcb.so
&
~/miniconda3/plugins/platforms/libqxcb.so
根据 TranslucentCloud 的建议 here,我已将其复制到目录 ~/miniconda3/bin/platforms
(新创建)。
我还在调用我的代码的脚本中包含了 export QT_DEBUG_PLUGINS=1
。这给出了以下输出:
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"
现在可以加载 GUI 和按钮等。但是,仍然存在一些问题 - 小问题是所有字体都与我本地机器不同(不是主要问题,但可能表明它仍然没有找到一些相关的库)。
更严重的是,GUI 不响应任何按键操作 - GUI 有很多文本框需要填写,因此无法使用。
上面的输出中显然仍然存在一些错误,但是,从中不清楚哪些库等仍然无法找到(或者为什么会这样)。
解决上述错误需要一些步骤:
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)
这可以通过将 ~/miniconda3/plugins/platforms
复制到 ~/miniconda3/bin
来解决。
此外,在启动 Qt GUI 的 bash 脚本中,我添加了以下行,否则 GUI 中的所有文本都会出现在 Courier 中:
export FONTCONFIG_FILE=/etc/fonts/fonts.conf
export FONTCONFIG_PATH=/etc/fonts/
最后我还需要以下行来允许 GUI 注册按键:
export QT_XKB_CONFIG_ROOT=/usr/share/X11/xkb
解决这个问题的关键是:
export QT_DEBUG_PLUGINS=1
这使我能够看到 Qt 哪里出了问题。