使用Windows Power shell将Tkinter py文件转换为EXE文件



我正在尝试使用Windows Power shell将我的tkinterpython文件转换为.exe。但是我得到了以下错误。

递归错误:超出最大递归深度

我的源代码 .

from tkinter import *
from tkinter.filedialog import askopenfile
from openpyxl import load_workbook
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from matplotlib import rcParams
# figure size in inches
rcParams['figure.figsize'] = 5,6
root = Tk()
root.geometry('400x400')
def open_file():
file = askopenfile(mode ='r', filetypes =[('Excel Files', '*.xlsx')])
print(file)
print(type(file))
print(file.name)

data=pd.read_excel(file.name)
print(pd.crosstab(data["Sex"],data.Survived))
ax = sns.countplot(x = 'Sex', hue = 'Survived', palette = 'Set1', data = data)
ax.set(title = 'Total Survivors According to Sex', xlabel = 'Sex', ylabel='Total')
plt.show()
wb = load_workbook(filename = file.name,read_only=True) # Load into openpyxl
wb2 = wb.active
#Whatever you want to do with the WorkSheet
btn = Button(root, text ='Open excel sheet', command = open_file)
btn.pack(side='top')
#btn.pack(side='bottom')
root.mainloop()

我假设您需要将 Python 文件转换为 EXE。 如果是这样,有很多库可用于将 Python 文件转换为 EXE 文件。 我使用的一个最好的是PyInstaller。你可以试试。请参阅此链接了解更多信息 : https://datatofish.com/executable-pyinstaller/

最新更新