首页 > 其他分享> > 运行pyside2报错This application failed to start because no Qt platform plugin could be initialized.
运行pyside2报错This application failed to start because no Qt platform plugin could be initialized.
作者:互联网
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
加入这几行代码就ok啦,可以跳出来自己设计的界面了。
标签:because,plugin,platform,报错,PySide2,import,path,dirname,os 来源: https://blog.csdn.net/qq_43263543/article/details/116331640