[英]Converted .py file to .exe and .exe file wont open properly
So I recently managed to convert a.py file into.exe but the problem is that the.exe file wont open properly.所以我最近设法将 a.py 文件转换为 .exe,但问题是 .exe 文件无法正常打开。 Basically what happens is the command prompt opens for a second and then shows some code for 1 milisecond and closes.
基本上发生的事情是命令提示符打开一秒钟,然后显示一些代码 1 毫秒然后关闭。 I did manage to get a screenshot of what the command prompt says.
我确实设法获得了命令提示符所说内容的屏幕截图。 This keeps happening when I try to open it but not with just that file, but every.py file I convert into.exe
当我尝试打开它时,这种情况一直在发生,但不仅仅是那个文件,而是我转换成 .exe 的每个 .py 文件
I made a simple code to check if it was only like that for my previous code but its for every code that I make.我编写了一个简单的代码来检查它是否仅适用于我以前的代码,但它适用于我制作的每个代码。 I also used PyInstaller to convert the.py file into a.exe
我还使用 PyInstaller 将 .py 文件转换为 .exe
import customtkinter as tk
import sys
import os
root = tk.CTk()
root.state('zoomed')
root.wm_title("Test File")
frame = tk.CTkFrame(master=root, height=300, width=600)
frame.pack_propagate(0)
frame.pack(pady=200)`
lbl = tk.CTkLabel(master=frame, text="I like chicken nuggets.", font=("Bahnschrift", 30))
lbl.pack(pady=120)
root.mainloop()
If something is unclear about my explanation, please ask.如果我的解释不清楚,请询问。 Im on Windows 11 and I use VS Code.
我在 Windows 11 上,我使用 VS Code。
I asked for help on Discord but no luck.我在 Discord 上寻求帮助,但没有成功。 Im hoping somebody could help me here.
我希望有人能在这里帮助我。 I want my.exe file to open up like a charm and do its job.
我希望 my.exe 文件能够像魅力一样打开并完成它的工作。
There is another user faced with the same issue.还有另一个用户面临同样的问题。 I believe this may help:
我相信这可能会有所帮助:
Problem in making an exe file using Pyinstaller (file made using tkinter and Custom tkinter) 使用 Pyinstaller 制作 exe 文件时出现问题(使用 tkinter 和 Custom tkinter 制作的文件)
I suggest using auto-py-to-exe since it's easier to use.我建议使用 auto-py-to-exe,因为它更容易使用。 To install type this:
要安装,请输入:
pip install auto-py-to-exe
To run type this:要运行,请输入:
auto-py-to-exe
Then you'll see something like this:然后你会看到这样的东西:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.