我一直在尝试打包一个完全从.py文件运行的Kivy应用程序。我使用PyInstaller模块来创建.exe文件。 .exe文件已创建但无法打开。 我尽我所能,并且已经完成了Kivy文档https://kivy.org/docs/guide/packaging-windows.html#。
我注意到.exe文件只有在导入的kivy模块时才能工作,但在导入其他库(如pandas)时无法工作。
任何帮助都将不胜感激。
from kivy.app import App
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.button import Button
from tkinter.filedialog import askopenfilename
from kivy.lang import Builder
from kivy.uix.label import Label
from kivy.config import Config
import pandas as pd
import sqlite3
from kivy.properties import StringProperty
Config.set('graphics', 'resizable', '0')
Config.set('graphics', 'width', '800')
Config.set('graphics', 'height', '450')
def databasesetup(sharepoint,exchange,onedrivefaculty,onedrivestudent):
def sharepoint(filename):
def exchangecleanup(file):
def OD4Bclean(filename):
class Container(BoxLayout):
Message = StringProperty()
def Selectfile(self):
def Selectfilecsv(self):
def Cleandata(self):
""" This function cleans all the uploaded files and returns the cleaned dataframes """
def CreateDatabase(self):
def downloadfiles(self):
class MainApp(App):
def build(self):
self.title = 'Technology Support App for Office 365 adoption'
return Container()
if __name__ == "__main__":
app = MainApp()
app.run()
.spec文件
from kivy.deps import sdl2, glew
# -*- mode: python -*-
block_cipher = None
a = Analysis(['main.py'],
pathex=['D:\\Users\\bodea\\Documents\\desktop kivy app\\main'],
binaries=[],
datas=[],
hiddenimports=[],
hookspath=[],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher)
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
exe = EXE(pyz,
a.scripts,
exclude_binaries=True,
name='main',
debug=False,
strip=False,
upx=True,
console=True )
coll = COLLECT(exe,Tree('D:\\Users\\bodea\\Documents\\desktop kivy app\\main'),
a.binaries,
a.zipfiles,
a.datas,*[Tree(p) for p in (sdl2.dep_bins + glew.dep_bins)],
strip=False,
upx=True,
name='main')