Форум сайта python.su
Хочу собрать програмку в в синг exe файл.
Код програмки
import pycurl
from distutils.core import setup
import py2exe
import sys
if not 'py2exe' in sys.argv:
sys.argv.append('py2exe')
options = {"py2exe": {"compressed": 1,
"optimize": 1,
"packages": ['encodings'],
"bundle_files": 1,
}
}
program = {"script": "test3.py"}
setup(
options = options,
windows = [program],
zipfile = None,
# zipfile = "lib/libraries.zip",
)
Traceback (most recent call last):
File "test3.py", line 4, in <module>
File "zipextimporter.pyo", line 98, in load_module
ImportError: MemoryLoadLibrary failed loading pycurl.pyd
Офлайн
Уберите bundle_files, с ним постоянно проблемы вылезают…
Офлайн
Я вполне понимаю, что убрав его у меня все отлично заработает.
Но мне нужен один exe.
Есть ли другие варианты?
Офлайн
попробуй pyinstalers
Офлайн
PitPytoniПопробовал..
попробуй pyinstalers
import pycurl, time
from PyQt4 import QtGui4, QtCore4
ImportError: cannot import name QtGui4
W: no module named _dummy_threading (top-level import by dummy_threading)
W: no module named pwd (delayed, conditional import by posixpath)
W: no module named ctypes.cdll (delayed import by ctypes.util)
W: no module named fcntl (conditional import by subprocess)
W: no module named readline (delayed import by pdb)
W: no module named AES (delayed, conditional import by archive)
W: no module named _scproxy (conditional import by urllib)
W: no module named pwd (delayed import by getpass)
W: no module named posix (delayed, conditional import by iu)
W: no module named EasyDialogs (conditional import by getpass)
W: no module named PyQt4._qt (top-level import by PyQt4.QtCore)
W: no module named termios (top-level import by getpass)
W: no module named org (top-level import by copy)
W: no module named fcntl (top-level import by tempfile)
W: no module named readline (delayed, conditional import by cmd)
W: no module named win32wnet (delayed import by uuid)
W: no module named PyQt4._qt (top-level import by PyQt4.QtGui)
W: no module named win32api (delayed import by iu)
W: no module named netbios (delayed import by uuid)
W: no module named _emx_link (conditional import by os)
W: no module named posix (conditional import by os)
W: no module named org (top-level import by pickle)
W: no module named rourl2path (conditional import by urllib)
W: no module named PyQt4._qt (top-level import by PyQt4)
Отредактировано (Март 16, 2010 15:38:38)
Офлайн
pyinstaller лучше в 10 раз, да и ничего в нём сложного нет
makespec.py -X -F -w C:\py\pyfie.py
build.py D:\pathtopyinstaller\dist\pyfile.spec
Офлайн
jartasaКакое точное замечание на тему разговора.
pyinstaller лучше в 10 раз, да и ничего в нём сложного нет
makespec.py -X -F -w C:\py\pyfie.py
build.py D:\pathtopyinstaller\dist\pyfile.spec
Офлайн
По теме.. Научите что не так..
Использую pyinstaller
C:\Python26\python.exe C:\py26win\Makespec.py -F -X -w -d --icon=icon.ico --out=D:\Coding\toexe D:\Coding\toexe\exe.py
C:\Python26\python.exe C:\py26win\Build.py D:\Coding\toexe\exe.spec
Офлайн
topazz
не важно как ты это сделал , главное что сделал
Офлайн
topazzЯ для себя немного модифицировал mcgui.py
Exe собирается но иконку упорно не хочет вставляться.
#!/usr/bin/python
# Tkinter interface to the McMillan installer
# (c) 2003 Alan James Salmoni - yes, all this bad code is all mine!!!
# released under the MIT license
import os, os.path
from Tkinter import *
import tkFileDialog
import FileDialog
class McGUI:
def __init__(self):
root = Tk()
self.iin=None
fr1 = Frame(root)
fr1["width"] = 200
fr1["height"] = 100
fr1.pack(side="top")
fr2 = Frame(root)
fr2["width"] = 200
fr2["height"] = 300
fr2["borderwidth"] = 2
fr2["relief"] = "ridge"
fr2.pack()
fr4 = Frame(root)
fr4["width"]=200
fr4["height"]=100
fr4.pack(side="bottom")
getFileButton = Button(fr1)
getFileButton["text"] = "Script..."
getFileButton.bind("<Button>",self.GetFile)
getFileButton.pack(side="left")
self.filein = Entry(fr1)
self.filein.pack(side="right")
self.filetypecheck = Checkbutton(fr2)
self.filetypecheck["text"] = "One File Package "
self.filetype = IntVar()
self.filetypecheck["variable"] = self.filetype
self.filetypecheck.pack()
self.tkcheck = Checkbutton(fr2)
self.tkcheck["text"] = "Include Tcl/Tk "
self.tk = IntVar()
self.tkcheck["variable"] = self.tk
self.tkcheck.pack()
self.asciicheck = Checkbutton(fr2)
self.asciicheck["text"] = "Do NOT include decodings"
self.ascii = IntVar()
self.asciicheck["variable"] = self.ascii
self.asciicheck.pack()
self.useupx = Checkbutton(fr2)
self.useupx["text"] = "Use UPX"
self.upx = IntVar()
self.useupx["variable"] = self.upx
self.useupx.pack()
self.debugcheck = Checkbutton(fr2)
self.debugcheck["text"] = "Use debug versions "
self.debug = IntVar()
self.debugcheck["variable"] = self.debug
self.debugcheck.pack()
self.noconsolecheck = Checkbutton(fr2)
self.noconsolecheck["text"] = "No console (Windows only)"
self.noconsole = IntVar()
self.noconsolecheck["variable"] = self.noconsole
self.noconsolecheck.pack()
getIconButton = Button(fr2)
getIconButton["text"] = "Icon..."
getIconButton.bind("<Button>",self.GetIcon)
getIconButton.pack(side="left")
self.iconin = Entry(fr2)
self.iconin.pack(side="right")
okaybutton = Button(fr4)
okaybutton["text"] = "Okay "
okaybutton.bind("<Button>",self.makePackage)
okaybutton.pack(side="left")
cancelbutton = Button(fr4)
cancelbutton["text"] = "Cancel"
cancelbutton.bind("<Button>",self.killapp)
cancelbutton.pack(side="right")
self.fin = ''
self.fout = ''
root.mainloop()
def killapp(self, event):
sys.exit(0)
def makePackage(self, event):
commands = 'Makespec.py '
if (self.filetype.get() == 1):
commands = commands + '--onefile '
if (self.tk.get() == 1):
commands = commands + '--tk '
if (self.ascii.get() == 1):
commands = commands + '--ascii '
if (self.debug.get() == 1):
commands = commands + '--debug '
if (self.noconsole.get() == 1):
commands = commands + '--noconsole '
if (self.upx.get() == 1):
commands = commands + '--upx '
if self.iin:
commands = commands +"--icon=" + self.iin + " "
commands = commands + self.fin
x = os.path.split(self.fin)
y = os.path.splitext(x[1])
os.system(commands)
commands = 'Build.py '+str(y[0])+os.sep+str(y[0])+'.spec'
os.system(commands)
sys.exit(0)
def GetFile(self, event):
self.fin = tkFileDialog.askopenfilename()
self.filein.insert(0,self.fin)
def GetIcon(self, event):
self.iin = tkFileDialog.askopenfilename()
self.iconin.insert(0,self.iin)
if __name__ == "__main__":
app = McGUI()
Офлайн