Python 2.7:如何在运行python gui .exe脚本时摆脱cmd窗口 [英] Python 2.7 : How to get rid of cmd window while running a python gui .exe script
问题描述
我有一个GUI脚本 run.py ,我使用pyinstaller将其转换为.exe文件.当我双击.exe文件时,将打开两个窗口.首先是我脚本的主GUI,其次是背景上的黑色cmd空窗口.
我在论坛上看到,将 run.py 另存为 run.pyw ,然后将其转换为.exe文件可以解决此问题.但就我而言,问题仍然存在.
有人在我运行.exe文件时有任何想法如何消除背景上的空cmd窗口吗?
尝试使用带有--noconsole选项的pyinstaller构建文件.exe.
https://pyinstaller.readthedocs.io/zh-CN/latest/usage.html#windows
I have a GUI script run.py which i turned into a .exe file using pyinstaller. When I double click on the .exe file two windows are opened. First the main GUI of my script and second the empty black cmd window on background.
I saw on forums that saving run.py as run.pyw and then converting it into .exe file will solve the problem. But in my case the problem remains same.
Does anyone have any idea how to get rid of this empty cmd window on background when i run my .exe file?
try to build your file .exe with pyinstaller with the options --noconsole
https://pyinstaller.readthedocs.io/en/latest/usage.html#windows
这篇关于Python 2.7:如何在运行python gui .exe脚本时摆脱cmd窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!