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问题
今天在装pyside2的时候心路历程可谓是十分艰辛了,好在最后都解决了。
首先是pip install时一直retrying的问题,与之同时发生的还有win10的手动设置代理一直打开,经过一系列搜索解决方法无果,最后我想起来之前使用ssr时因为代理没有效果删除了,删除前的一系列设置可能对这个有一定的影响,然后就又下载了回来,搞定了代理后pip就完全ok了。
之后就是标题所写的pyside2进行gui窗口编程时发生的错误了,同样经过了一系列的搜索折磨,最后在不停地吐槽国内博客转来转去找不到几个原创的答案之中,最后搜了下stackoverflow,然后就解决了。
总结一下思路:国内博客中通常是修改环境变量,这点是完全没问题的,但是由于国内博客大多写的是pyqt而不是pyside2,所以配置环境变量有所区别。
其实解决问题的方法也是配置环境变量,只不过路径不能只写到plugin,而要把platform也加入进去,当然也可以在每次编程时先加入这段代码再继续自己的代码:
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
如果想要一劳永逸,那么就多打一条print看一下pyside2安装目录:
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
print(plugin_path)
把输出获得的路径复制一下(第二行):

然后在环境变量中配置一下就可以了:

但配置环境还是有可能不行,那么有一个办法是基本可行的,也就是改包根目录下的__init__文件,在注释前加上上面的那串代码就可以(注意要把PySide2去掉):

PySide2的This application failed to start because no Qt platform plugin could be initialized解决方式的更多相关文章
- 【环境搭建】安装pyQt5 在pycharm报This application failed to start because no Qt platform plugin could be initialized的问题
报错:This application failed to start because no Qt platform plugin could be initialized 解决办法: http:// ...
- 解决QT5移植报错:This application failed to start because no Qt platform plugin could be initialized
今天自己基于Pyqt5开发了一个软件,打包成exe后在自己的电脑上运行正常,在其他机器上提示: This application failed to start because no Qt platf ...
- This application failed to start because no Qt platform plugin could be initialized
今天在直接运行QT生成的.exe遇到了一个错误:This application failed to start because no Qt platform plugin could be init ...
- is application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem
最近试着了解 c++,接触到了QT,写了一个测试程序,在开发环境下正常后移到非开发环境,报错 网上找资料说是少了platforms文件夹中的dll,把里面所有的dll复制到执行程序目录,还是提示,继续 ...
- pthon-安装新版PyQt5、PyQT5-tool后打不开并Designer.exe提示“This application failed to start because no Qt platform plugin could be initialized.Reinstalling the application the application may fix this program”
最近学习python,安装网上教程一步一步的安装,网上很多帖子都写的非常详细,不由深深感慨多谢各位不辞辛苦的记录,指导着来自新入门的同学. 但是实际安装中,最理想莫过于一次性安装成功,但自己安装就出现 ...
- This application failed to start because it could not find or load the Qt platform plugin "xcb".
1. copy libQt5DBus.so.5 2. add QT_PLUGIN_PATH blog.csdn.net/windows_nt/article/details/242 ...
- This application failed to start because it could not find or load the Qt platform plugin "xcb".
linux根据系统Qt5未安装编译的程序Qt在该系统下进行下面的错误会报: This application failed to start because it could not find or ...
- The trust relationship between this workstation and the primary domain failed(断网可以登进来)(正确的解决方式用管理员登进去 :退域再加域)
The trust relationship between this workstation and the primary domain failed(断网可以登进来)(正确的解决方式用管理员登进 ...
- This application failed to start because it could not find or load the Qt platform plugin “windows”错误解决方法
这是一个困扰我很久的问题,关于Qt下生成的exe文件在没有安装Qt的机器上无法运行的问题.Qt是编写C++图形界面的一个很好工具,比MFC来的直观.可是,Qt的安装却是一个让人头疼的事情.早在上个学期 ...
随机推荐
- SaaS|PaaS|iaas|
生物医疗大数据:云物移大智 云计算的三种模式:SaaS|PaaS|iaas 互联网:计算机之间的网络 物联网:物品之间的网络 移动:5G的三个特点:快:密:稳 大数据:4v:volume数据量大:ve ...
- 对xgboost中dump_model生成的booster进行解析
xgboost原生包中有一个dump_model方法,这个方法能帮助我们看到基分类器的决策树如何选择特征进行分裂节点的,使用的基分类器有两个特点: 二叉树: 特征可以重复选择,来切分当前节点所含的数据 ...
- imageMso7345.rar
本工具用于Office开发中的customUI设计,查询内置图标的工具. 解压后,有2个Excel文件. 第一个文件的动态图: 第2个文件也可以查询图标: 下载地址: imageMso7345.rar
- Select(快速选择顺序统计量)原理及C++代码实现
SELECT算法利用快排中的partition思想来进行无序数组的快速选择. 寻找第i个顺序统计量可以简单理解为寻找第i小的元素. 该算法通过为partition选择一个好的主元,来保证Partiti ...
- [LC] 40. Combination Sum II
Given a collection of candidate numbers (candidates) and a target number (target), find all unique c ...
- CentOS 6.5 搭建DNS服务器
1.安装bind yum install -y bind 2.修改named.conf主配置文件 vim /etc/named.conf 图中圈中的地方改为any 3.配置正向.反向解析 vim /e ...
- python可变类型和不可变类型,深拷贝vs浅拷贝
转载:https://www.cnblogs.com/huamingao/p/5809936.html 核心提示: 可变类型 Vs 不可变类型 可变类型(mutable):列表,字典 不可变类型(un ...
- 查看github仓库的地址
- cesium入门示例-矢量化单体分类
实现楼层的分层选择和属性信息展示,该功能基于大雁塔倾斜数据实现单体化分类显示. 数据准备: 1.大雁塔倾斜数据,已转换为3dTiles,参考cesium入门示例-3dTiles加载的第2节osgb数据 ...
- POJ 3522 用不同的排序方式
这是一个蜜汁WA了的代码.. 说好的样例对了就是对了呢orz 反正我个人认为思路是没问题的不知道WA在哪了,丢个坑在这里以后填吧 //思路: //1节点连接的边都记录下来,依次克鲁斯卡尔枚举得出最 ...