Python Py to。 exe隐蔽错误

时间:2017-12-25 07:18:11

标签: python-3.x tkinter pyinstaller py2exe

我正在执行以下代码的隐秘,我得到以下错误,你能帮助我吗

我在python 3版本中创建了代码并尝试转换单个exe文件。 大多数情况下,我想在Windows系统中运行exe文件,无需安装或安装。

我将py2exe导入python并尝试转换文件

    from tkinter import *
from f5.bigip import ManagementRoot
import urllib3
import csv
import socket
import sys
urllib3.disable_warnings()


root=Tk()
root.title("Automated Configuration Manager")
def new_window():
    new = Toplevel(root)
    menubar = Menu(new)
    vipmenu = Menu(menubar,tearoff=0)
    poolmenu = Menu(menubar, tearoff = 0)
    prulemenu = Menu(menubar, tearoff = 0)
    helpmenu = Menu(menubar, tearoff = 0)
    singlemenu = Menu(vipmenu, tearoff = 0)
    bulkmenu = Menu(vipmenu, tearoff = 0)
    #vipmenu = Menu(createmenu, tearoff = 0)
    menubar.add_cascade(label = "VIP", menu = vipmenu)
    menubar.add_cascade(label = "POOL", menu = poolmenu)
    menubar.add_cascade(label = "PRULE", menu = prulemenu)
    menubar.add_cascade(label = "HELP", menu = helpmenu)
    vipmenu.add_command(label = "Single")

    def new_window1():
        new1=Toplevel(new)
        b = Button(new1, text = "Browse", bd =5)
        b.pack()
        b = Button(new1, text = "Run", bd =5,command=SSH1)
        b.pack()
    new.config(menu = menubar)
    vipmenu.add_command(label = "Bulk",command=new_window1)

mainframe = Frame(root)
mainframe.grid(column=0,row=0, sticky=(N,W,E,S) )
mainframe.columnconfigure(0, weight = 1)
mainframe.rowconfigure(0, weight = 1)
mainframe.pack(pady = 100, padx = 100)

#choices = { 'F5','A5A','PA' }
var = StringVar() 
popupMenu = OptionMenu(mainframe, var,'F5','A5A','PA')
Label(mainframe, text="Choose a Option").grid(row = 1, column = 1)
popupMenu.grid(row = 2, column =1)


l1 = Label(root, text = "Enter IP Address:")
l1.pack()
global et1
global et2
global et3
et1 = Entry(root, bd = 5)
et1.pack()
a=et1.get()

l2 = Label(root, text = "User Name:")
l2.pack()
et2 = Entry(root, bd=5)
et2.pack()
b=et2.get()

g=StringVar()
g="enter password:"
l3=Label(root, text = g)
l3.pack()
et3 = Entry(root, bd=5, show = "*")
et3.pack()    
b = Button(root, text = "Open", bd =5,command=SSH)
b = Button(root, text = "Open", bd =5,command=new_window)
b.pack()




root.mainloop()

我在转换时遇到错误,

 C:\Users\krissara\AppData\Local\Programs\Python\Python36-32>python setup.txt py2
exe
running py2exe
Traceback (most recent call last):
  File "setup.txt", line 3, in <module>
    setup(console=['f5api.py'])
  File "C:\Users\krissara\AppData\Local\Programs\Python\Python36-32\lib\distutil
s\core.py", line 148, in setup
    dist.run_commands()
  File "C:\Users\krissara\AppData\Local\Programs\Python\Python36-32\lib\distutil
s\dist.py", line 955, in run_commands
    self.run_command(cmd)
  File "C:\Users\krissara\AppData\Local\Programs\Python\Python36-32\lib\distutil
s\dist.py", line 974, in run_command
    cmd_obj.run()
  File "C:\Users\krissara\AppData\Local\Programs\Python\Python36-32\lib\site-pac
kages\py2exe\distutils_buildexe.py", line 188, in run
    self._run()
  File "C:\Users\krissara\AppData\Local\Programs\Python\Python36-32\lib\site-pac
kages\py2exe\distutils_buildexe.py", line 267, in _run
    builder.analyze()
  File "C:\Users\krissara\AppData\Local\Programs\Python\Python36-32\lib\site-pac
kages\py2exe\runtime.py", line 160, in analyze
    self.mf.import_hook(modname)
  File "C:\Users\krissara\AppData\Local\Programs\Python\Python36-32\lib\site-pac
kages\py2exe\mf3.py", line 120, in import_hook
    module = self._gcd_import(name)
  File "C:\Users\krissara\AppData\Local\Programs\Python\Python36-32\lib\site-pac
kages\py2exe\mf3.py", line 274, in _gcd_import
    return self._find_and_load(name)
  File "C:\Users\krissara\AppData\Local\Programs\Python\Python36-32\lib\site-pac
kages\py2exe\mf3.py", line 357, in _find_and_load
    self._scan_code(module.__code__, module)
  File "C:\Users\krissara\AppData\Local\Programs\Python\Python36-32\lib\site-pac
kages\py2exe\mf3.py", line 388, in _scan_code
    for what, args in self._scan_opcodes(code):
  File "C:\Users\krissara\AppData\Local\Programs\Python\Python36-32\lib\site-pac
kages\py2exe\mf3.py", line 417, in _scan_opcodes
    yield "store", (names[oparg],)
IndexError: tuple index out of range

C:\Users\krissara\AppData\Local\Programs\Python\Python36-32>pip install py2exe

0 个答案:

没有答案