简体   繁体   English

程序无法作为单个noconsole exe文件运行(Pyinstaller)

[英]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.

相关问题 带有selenium(webdriver)的Python程序不能作为单个noconsole exe文件工作(pyinstaller) - Python program with selenium(webdriver) Don't Work as single and noconsole exe file (pyinstaller) 带有--noconsole的Windows上的pyinstaller无法正常工作 - pyinstaller on Windows with --noconsole simply won't work Pyinstaller 生成的 exe 无法正常工作 - Pyinstaller generated exe doesn't work properly pyinstaller 生成的 exe 无法按预期工作 - exe generated by pyinstaller doesn't work as expected PyInstaller:单文件可执行文件不起作用 - PyInstaller: Single-file executable doesn't work Pyinstaller --windowed或--noconsole .exe不允许chromedriver打开 - Pyinstaller --windowed or --noconsole .exe not allowing chromedriver to open pyinstaller2.0 --noconsole在我单击它时不会运行我的exe - pyinstaller2.0 --noconsole won't run my exe when I click on it 我的exe 从 pyinstaller 创建的文件不像它是 .py 时那样工作(Pyexcel 问题) - My exe. file created from pyinstaller doesn't work like it does when it was .py (Pyexcel problem) Pygame 使用pyinstaller导出到.exe后游戏无法运行 - Pygame game doesn't work after exporting to .exe with pyinstaller 运行良好的 Plotly express map 不能作为 Pyinstaller exe 工作 - Plotly express map that runs fine doesn't work as Pyinstaller exe
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM