2025年py文件打开后闪退(py文件为什么闪退)

py文件打开后闪退(py文件为什么闪退)tbody tr td id artContent style max width 656px div style width 656px margin 0 padding 0 height 0 div td tr tbody

大家好,我是讯享网,很高兴认识大家。




讯享网

 <tbody> <tr> <td id="artContent" style="max-width: 656px;"> <div style="width: 656px; margin: 0; padding: 0; height: 0;"></div> <p style="margin-left: 1em;margin-right: 1em;" data-mpa-powered-by="yiban.io"><strong>问题:</strong></p><p style="margin-left: 1em;margin-right: 1em;"><strong>1、用python编写后的程序文件如何变成exe可执行文件?</strong></p><p style="margin-left: 1em;margin-right: 1em;"><strong>2、Pyinstaller打包后的exe文件打开闪退,如何解决?</strong></p><p style="margin-left: 1em;margin-right: 1em;"><strong><span style="color: rgb(136, 136, 136);">参阅以下网站介绍方法,借鉴学习并验证方法。</span></strong></p><p style="margin-left: 1em;margin-right: 1em;"><span style="color: rgb(255, 0, 0);"><strong>答1:</strong></span></p><p style="margin-left: 1em;margin-right: 1em;">https://blog.csdn.net/weixin_/article/details/<br><br></p><p style="margin-left: 1em;margin-right: 1em;"><span style="color: rgb(77, 77, 77);font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun;font-size: 16px;text-align: start;background-color: rgb(255, 255, 255);">第一步:需要安装一个模块</span>。</p><p style="text-align: left;margin-left: 1em;margin-right: 1em;"><span style="color: rgb(77, 77, 77);font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun;font-size: 16px;text-align: start;background-color: rgb(255, 255, 255);">首先在windows命令窗口下输入安装模块命令</span>。</p><p style="text-align: left;margin-left: 1em;margin-right: 1em;">如:c:퇬adminpip install pyinstaller</p><p style="outline: 0px;margin-bottom: 16px;font-size: 16px;color: rgb(77, 77, 77);overflow: auto hidden;font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun;text-align: start;white-space: normal;background-color: rgb(255, 255, 255);line-height: 26px !important;margin-left: 1em;margin-right: 1em;">第二步:安装完上述模块后,在命令窗口下,切换到要打包源文件的目录下。</p><p style="outline: 0px;margin-bottom: 16px;font-size: 16px;color: rgb(77, 77, 77);overflow: auto hidden;font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun;text-align: start;white-space: normal;background-color: rgb(255, 255, 255);line-height: 26px !important;margin-left: 1em;margin-right: 1em;">第三步:在命令行中输入如下图所示(假设源文件放在d盘根目录下),输入完成 按回车就开始打包。</p><p style="text-align: left;margin-left: 1em;margin-right: 1em;">D:pyinstaller&nbsp;-F&nbsp;tm.by</p><p style="text-align: left;margin-left: 1em;margin-right: 1em;"><span style="color: rgb(77, 77, 77);font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun;font-size: 16px;text-align: start;background-color: rgb(255, 255, 255);">第四步:D盘的根目录下会看到一个dist文件夹,打开它,你会看到生成成功的exe文件,双击tm.exe 文件可以直接运行程序。</span></p><p style="text-align: left;margin-left: 1em;margin-right: 1em;"><span style="color: rgb(77, 77, 77);font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun;font-size: 16px;text-align: start;background-color: rgb(255, 255, 255);">附:</span></p><p style="margin-left: 1em;margin-right: 1em;">pyinstaller -F xxx.py&nbsp; 打包成一个单独的exe,但是会有黑窗口</p><p style="margin-left: 1em;margin-right: 1em;">pyinstaller -F&nbsp; -w xxx.py去除黑窗口</p><p style="text-align: left;margin-left: 1em;margin-right: 1em;"><strong><span style="color: rgb(255, 0, 0);background-color: rgb(255, 255, 255);font-size: 16px;font-family: -apple-system, &quot;SF UI Text&quot;, Arial, &quot;PingFang SC&quot;, &quot;Hiragino Sans GB&quot;, &quot;Microsoft YaHei&quot;, &quot;WenQuanYi Micro Hei&quot;, sans-serif, SimHei, SimSun;">答2:</span></strong></p><p><span style="font-size: 15px;background-color: rgb(255, 255, 255);color: rgb(34, 34, 38);font-family: -apple-system, BlinkMacSystemFont, &quot;Segoe UI&quot;, DIN_Condensed, &quot;Helvetica Neue&quot;, Arial, &quot;Noto Sans&quot;, sans-serif;text-align: start;">https://download.csdn.net/download/weixin_/?spm=1001.2101.3001.6661.1&amp;utm_medium=distribute.pc_relevant_t0.none-task-download-2%7Edefault%7ECTRLIST%7Edefault-1.highlightwordscore&amp;depth_1-utm_source=distribute.pc_relevant_t0.none-task-download-2%7Edefault%7ECTRLIST%7Edefault-1.highlightwordscore</span></p><p style="text-align: left;margin-left: 1em;margin-right: 1em;">应用答1的方法,把代码打包后,生成exe执行文件。但双击运行后,一闪而过。</p><p style="text-align: left;margin-left: 1em;margin-right: 1em;">参阅答2链接方法, 在windows系统中的解决方法,如下:</p><p style="text-align: left;margin-left: 1em;margin-right: 1em;">step 1: winkey + r</p><p style="text-align: left;margin-left: 1em;margin-right: 1em;">step&nbsp;2: cd进入到对应的dist文件夹中&nbsp;</p><p style="text-align: left;margin-left: 1em;margin-right: 1em;">step 3: .xxx.exe</p> </td> </tr> </tbody> 

讯享网
小讯
上一篇 2025-04-22 10:30
下一篇 2025-06-16 23:57

相关推荐

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容,请联系我们,一经查实,本站将立刻删除。
如需转载请保留出处:https://51itzy.com/kjqy/196167.html