This application failed to start because no Qt platform plugin could be initialized.解决

https://gitee.com/se7enXF/pyside2/tree/master/Lesson_1.%E7%8E%AF%E5%A2%83%E9%85%8D%E7%BD%AE%E4%B8%8E%E5%85%A5%E9%97%A8

基本操作来源于以上链接

安装好pyside2后,运行他的程序出现了错误。
This application failed to start because no Qt platform plugin could be initialized.解决_第1张图片

参考下面的链接

https://www.cnblogs.com/IaCorse/p/12024428.html

在文本前面添加了下面代码:

import sys,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

然后成功运行。

你可能感兴趣的:(问题,python)