[英]Program doesn't work as single and noconsole exe file (Pyinstaller)
I made a program with python and I want to turn it into an .exe file. 我用python编写了一个程序,我想将其转换为.exe文件。 I typed that command from the command prompt (cmd):
我从命令提示符(cmd)键入了该命令:
pyinstaller --onefile --noconsole script.py
I used Tkinter in my script. 我在脚本中使用了Tkinter。 When I run the .exe file, a window didn't appear.
当我运行.exe文件时,没有出现窗口。 How can I solve it?
我该如何解决?
@Charitoo I'm using Windows 7 32bit, Python 2.7.3 @Charitoo我正在使用Windows 7 32位,Python 2.7.3
Use this command. 使用此命令。
pyinstaller --onefile --windowed script.py
That should solve the problem. 那应该解决问题。
I've solved my problem, because I could understand the reason for it. 我已经解决了我的问题,因为我可以理解原因。 I was using this code in my Python script:
我在Python脚本中使用了以下代码:
from subprocess import check_output
check_output("chcp 1254", shell=True)
I deleted these codes and my problem was solved. 我删除了这些代码,问题得以解决。
These codes were the reason for the problem, because I was creating an exe file which doesn't have a console screen, but I was using a command which tries to access the command line. 这些代码是造成问题的原因,因为我正在创建一个没有控制台屏幕的exe文件,但是我正在使用尝试访问命令行的命令。 Therefore, my program was closing.
因此,我的程序正在关闭。 Thanks to everybody.
感谢大家。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.