用py2exe编译程序后,它没有启动,唯一出现的是命令提示符在屏幕上快速闪烁(图1)
图1: https://gyazo.com/088bf4ad71d11d8025ceffb1e3fa67d5
这是我的py2exe安装脚本: https://gyazo.com/884368e712a402101f3ed5549799e826
在打开文件夹之前添加到文件夹中的所有依赖项(如图片和其他内容)。
编辑:示例代码
import subprocess
import os
import platform
import sys
from Tkinter import *
from PIL import ImageTk, Image
menu=Tk()
menu.wm_title("xCheat")
def reset():
img=ImageTk.PhotoImage(Image.open("mcomain.png"))
imglabel=Label(menu, image=img).grid(row=0, column=0,columnspan=2)
test3=Label(text="Coded By Jmilicev",fg="black",font="Arial 10")
test3.grid(row=12,column=0,columnspan=2)
test3.grid(sticky="WE")
resource_dir = os.path.join(os.path.dirname(__file__), 'resources');
def Button1():
os.startfile(os.path.join(resource_dir, 'LastActivityViewer.exe'))
def Button2():
os.startfile(os.path.join(resource_dir, 'pho.exe'))
def Button3():
os.startfile(os.path.join(resource_dir, 'procexp.exe'))
def Button4():
os.startfile(os.path.join(resource_dir, 'IJ.exe'))
def Button5():
os.startfile(os.path.join(resource_dir, 'Br.exe'))
def Button22():
os.startfile(os.path.join(resource_dir, 'sky.bat'))
def Programs():
b1=Button(text="Last Activity Viewer",fg="red",bg="black",command=Button1)
b1.grid(row=1,column=0)
b1.grid(sticky="WE,NS")
b1.config(height=4,width=0)
b2=Button(text="Process Hacker",fg="red",bg="black",command=Button2)
b2.grid(row=1,column=1)
b2.grid(sticky="WE,NS")
b2.config(height=4,width=0)
b3=Button(text="Process Explorer",fg="red",bg="black",command=Button3)
b3.grid(row=2,column=0)
b3.grid(sticky="WE,NS")
b3.config(height=4,width=0)
b14=Button(text="Search Everything",fg="red",bg="black",command=Button14)
b14.grid(row=2,column=1)
b14.grid(sticky="WE,NS")
b14.config(height=4,width=0)
menu.mainloop()
reset()
答案 0 :(得分:1)
可能是很多事情,错误报告将有助于确定原因。
请在命令提示符下运行程序并分享输出。
py2exe的一个很好的替代品是cx_freeze,一些示例代码:
# run this code as: compile.py
import cx_Freeze
executables = [cx_Freeze.Executable("xCheat.py")]
cx_Freeze.setup(
name="xCheat",
options={"build_exe": {"packages":["LIBRARY_NAME",],
"include_files":[]}}, # accepts directory names
executables = executables
)