报错内容:
This application failed to start because no Qt platform plugin could be
initialized. Reinstalling the application may fix this problem.
Available platform plugins are: direct2d, minimal, offscreen, windows.
原因分析:
多为 qdirect2d.dll、qminimal.dll、qoffscreen.dll、qwindows.dll 版本问题,
exe可执行文件, 使用了版本不一致的 .dll 动态库。
需要检测操作系统环境变量制定的插件平台库版本:我本地有如下两个版本,分别测试,找一个正确的。
D:\msys64\mingw64\share\qt5\plugins\platforms
D:\Qt\6.6.3\mingw_64\plugins\platforms
C:\Program Files\KDiff3\bin\platforms
QT_PLUGIN_PATH = D:\msys64\mingw64\share\qt5\plugins
解决办法:
将如下文件
\Anaconda3\Lib\site-packages\PySide2\plugins\platforms\qminimal.dll
\Anaconda3\Lib\site-packages\PySide2\plugins\platforms\qoffscreen.dll
\Anaconda3\Lib\site-packages\PySide2\plugins\platforms\qwindows.dll
复制(或覆盖)到这个文件夹即可
\Anaconda3\Library\plugins\platforms\