使用 Pyinstaller 冻结 Python 程序时摆脱控制台输出 [英] Getting rid of console output when freezing Python programs using Pyinstaller

查看:63
本文介绍了使用 Pyinstaller 冻结 Python 程序时摆脱控制台输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近使用 Python 和来自 Tkinter 的 GUI 为我的祖父编写了一个相当简单的程序,它非常适合他将使用它的目的.但是,当然还有丑陋的控制台输出窗口.我通过简单地将文件的扩展名从 .py 更改为 .pyw 就成功地摆脱了它.当我使用 PyInstaller 冻结它时,它再次出现!我有什么办法可以解决这个问题吗?

I have recently written a fairly simple program for my grandfather using Python with GUI from Tkinter, and it works beautifully for what he will be using it for. However, there is, of course, the ugly console output window. I have successfully gotten rid of it by simply changing the extension of the file from .py to .pyw. When I freeze it using PyInstaller, it reappears again! Is there any way for me to fix this?

提前致谢.

推荐答案

如果要隐藏控制台窗口,这里 是文档:这就是您如何使用 --noconsole 选项

If you want to hide the console window, here is the documentation: This is how you use the --noconsole option

python pyinstaller.py --noconsole yourscript.py

如果您需要使用 pyinstaller 的帮助来达到需要使用 --noconsole 选项的程度 这里是一个简单的教程.

If you need help using pyinstaller to get to the point where you need to use the --noconsole option here is a simple tutorial for getting there.

这篇关于使用 Pyinstaller 冻结 Python 程序时摆脱控制台输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆