使用pyside2时出现如下问题,主要是缺少环境变量所致,可以直接在系统中添加或是通过代码解决。
qt.qpa.plugin: Could not load the Qt platform plugin "windows" in "" 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: direct2d, minimal, offscreen, windows.
在代码头部添加如下:
import os
import PySide2
dirname = os.path.dirname(PySide2.__file__)
plugin_path = os.path.join(dirname, 'plugins', 'platforms')
os.environ['QT_QPA_PLATFORM_PLUGIN_PATH'] = plugin_path
来源:CSDN
作者:奈何如此
链接:https://blog.csdn.net/u012921982/article/details/104117488