python - 使用 windows power shell 将 Tkinter py 文件转换为 EXE 文件
问题描述
我正在尝试将我的tkinter
python 文件转换为.exe
使用 windows power shell。但我得到了错误。
RecursionError:超出最大递归深度
我的源代码。
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/
推荐阅读
- ios - 如何在 ARKit 中测量检测到的水平面与地板之间的距离
- javascript - 函数参数可以拥有javascript中的方法吗?
- python - 尝试从 Python3 子进程中执行 Python2 二进制文件时出错
- pandas - Pandas: Groupby Fill 消失列
- excel - 如果有空白单元格,如何使用 MAXIFS 返回空白?
- javascript - Javascript Setter 不是函数错误
- python - 从 API 获取数据时 tkinter 窗口无响应
- css - 带有 text-wrap 和 flex-wrap 的 Flex 布局
- kivy - 如何将值从文本字段移动到列表?KivyMD 和 Python
- ssh - 当我运行“ssh git@gitlab.com”时会发生什么