PySide2运行出错问题解决

 

PySide2是QT官方出的Python的QT封装, 不过默认安装运行时候会有一些小问题, 可能是系统里已经安装过其他版本QT的原因, 会报错如下:

 

PySide2 qt.qpa.plugin: Could not load the Qt platform plugin "xcb" 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: eglfs, minimal, minimalegl, offscreen, vnc, xcb.

 

可以通过添加环境变量来解决:

 

envpath = '/home/ckboss/anaconda3/lib/python3.6/site-packages/PySide2/Qt/plugins/platforms'
os.environ['QT_QPA_PLATFORM_PLUGIN_PATH'] = envpath

 

posted @ 2019-03-11 19:42  酱_油  阅读(2426)  评论(0编辑  收藏  举报