栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Python

pyinstaller生成含pyqt5的exe文件报错:qt.qpa.plugin: Could not load the ······even though it was found

Python 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

pyinstaller生成含pyqt5的exe文件报错:qt.qpa.plugin: Could not load the ······even though it was found

目录
  • 问题描述
  • 本人部分库版本:
  • 在尝试了以下方法后均无效
  • 方法

问题描述

pyinstaller生成包含pyqt5的exe文件的时候,对话框报错“qt.qpa.plugin: Could not load the Qt platform plugin “windows” in “” even though it was found”。

本人部分库版本:

anaconda 2020.02
由于项目需要,通过降级(方法见:https://zhuanlan.zhihu.com/p/97790723)把默认的python3.7降级到python3.6

更新特定版本的库用:
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pyinstaller==4.0

在尝试了以下方法后均无效
  1. https://www.likecs.com/show-266823.html

    这个极其不推荐哦,建议尝试的时候做好备份,覆盖掉的文件是Qt-designer的必要组件,会导致designer打不开。
  2. https://blog.csdn.net/nima1994/article/details/81106902
  3. https://blog.csdn.net/sgcc_zhs/article/details/18237957
方法

创建新的虚拟环境,然后在新的环境下安装pyinstaller,然后生成exe文件,就可以了(可能是anaconda部分包不兼容的问题,新的虚拟环境下包少,所以出错的概率就小,总之就是莫名其妙)

  1. 创建一个名为“xuni1”新的虚拟环境
    打开新的cmd窗口,输入
conda create -n xuni1 python=3.6

一路“Yes”
2. 在虚拟环境中安装必要的库(其实只有pyinstaller一个)
本人用vscode,打开后在左下角选择解释器Interpreter

选择解释器路径

解释器的路径应该是新建的虚拟环境下的
查看虚拟环境的位置,用:

conda env list

去“xuni1”的目录下选择python.exe

  1. pyinstaller生成exe文件
pyinstaller -F Your_Python_File_Name.py

大功告成

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/461773.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号