PySide报错:This application failed to start because not Qt platform plugin could be initialized

描述错误

启动 pyside2 程序,报错如下:

This application failed to start because not Qt platform plugin could be initialized.Reinstalling the application may fix this problem.

解决方式一

在程序初始部分添加如下代码:

dirname = os.path.dirname(PySide2.__file__)
plugin_path = os.path.join(dirname, 'plugins', 'platforms')
os.environ['QT_QPA_PLATFORM_PLUGIN_PATH'] = plugin_path

其他方式

https://blog.csdn.net/weixin_43917589/article/details/106137952


原文出处:https://www.malaoshi.top/show_1IX4GzKC10kV.html