python打包pandas工具,import慢

用python写了一个小程序,需要发布给全公司使用,界面用tkinter,import了pandas/os/time/threading/tkinter模块,pycharm环境下运行无异常界面秒出,但用pyinstaller打包为exe文件,启动巨慢,运行exe文件需要等待1min左右才能显示界面。于是打包命令删除-w后重新打包用于测试,测试后发现是importPandas模块使用了大量的时间。

print(1)
from tkinter import Button,filedialog,Text,Frame,Label,Tk
print(2)
import pandas as pd
print(3)
....




控制台显示1,说明程序已经开始运行,显示2说明tkinter已经import完毕,但过了差不多40s左右才显示3,同时GUI也显示出来了。
说明问题出在pandas的引入过程中,import pandas占据了大量的时间。
怎么才能解决pandas打包后引入过慢的问题呢?python版本3.6.8,pandas版本1.1.5,pyinstaller版本4.8.

这种情况, 用 from pandas import xx , 然后修改相应的代码, 把pd. 删除
比如你只用到 读excel 和 dataframe

from pandas import read_excel,DataFrame

这样会快点, 但pyinstaller 打包后会不会出现问题,要测试一下。