有人用Pyinstaller成功地将数据文件捆绑到一个文件中吗?

时间:2016-08-15 07:35:22

标签: python windows python-2.7 pyinstaller

我一直在梳理Stack Overflow以及其他网页上关于如何将数据文件添加到我的python应用程序中的信息:

import Tkinter

class simpleapp_tk(Tkinter.Tk):
    def __init__(self,parent):
        Tkinter.Tk.__init__(self,parent)
        self.parent = parent
        self.initialize()

    def initialize(self):
        self.grid()

--- Everything Fine Here ---

        self.B = Tkinter.Button(self, text = 'Create Document', command = self.OnButtonClick)
        self.B.grid(column = 0, row = 6)


    def OnButtonClick(self):
        createDoc()

if __name__ == "__main__":
    app = simpleapp_tk(None)
    app.title('Receipt Form')
    app.iconbitmap(os.getcwd() + '/M.ico')
    app.mainloop()

我尝试过使用.spec文件而没有运气

Onedir工作正常,但是当我尝试编译成单个可执行文件时,它会出现错误,即文件' M.ico'没有定义。

如果有人能够将带有pyinstaller的数据文件捆绑到一个文件中。请帮忙。谢谢。

我在使用PyInstaller 3.2运行Python 2.7的Windows 10计算机上

0 个答案:

没有答案