pycharm打包程序运行时弹出Failed to execute script..

前言

昨天写了一个搜索城市获得近三十天 的一个小程序,打包后弹出Failed to execut script Weather(PS:我的文件名称为Weather.py)一下子给我干蒙了。
我用的是pyinstaller进行打包的

pyinstaller -F -w Weather.py

在这里插入图片描述
结果一运行就报错。后来百度了好多解决办法。终于让我找到了。只要把-w取消了就行

pyinstaller -F Weather.py

这样就可以完美运行了。
在这里插入图片描述

出"This application failed to start because no Qt platform plugin could be initialized"错误是因为在pycharm运行程序时缺少Qt平台插件的库文件。这个错误通常发生在缺少xcb库文件或者没有正确配置Qt平台插件路径的情况下。 解决这个问题的方法是确保正确安装了Qt平台插件,并将插件路径配置到环境变量中。 首先,你可以尝试重新安装应用程序,这可能会修复问题。如果问题仍然存在,可以按照以下步骤解决问题: 1. 找到你的Qt平台插件的路径,通常是在你的pycharm安装目录下的qt/plugins文件夹中。 2. 打开pycharm,点击"File",然后选择"Settings"。 3. 在"Settings"窗口中,选择"Build, Execution, Deployment",然后选择"Python Interpreter"。 4. 在"Python Interpreter"页签中,选择你的项目的解释器。 5. 在右侧的"Environment"字段中,点击编辑按钮。 6. 在编辑环境变量的对话框中,添加一个新的环境变量,名称为"QT_QPA_PLATFORM_PLUGIN_PATH",值为Qt平台插件的路径。 7. 点击确定保存更改。 现在,重新运行程序,应该就能够正常启动了。如果问题仍然存在,可能是由于其他问题引起的,你可以尝试重新安装Qt和pycharm,或者在开发环境中查找其他解决方案。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [This application failed to start because no Qt platform plugin could be initialized. Reinstalling th](https://blog.csdn.net/weixin_45297905/article/details/127703251)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] - *2* *3* [成功解决This application failed to start because no Qt platform plugin could be initialized.](https://blog.csdn.net/weixin_62087061/article/details/128910228)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

道长王也

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值