虽然打包前程序能正常运行,但是打包后执行却出现如下报错
pyinstaller打包 报错:apscheduler No trigger by the name "cron" was found
解决方式:
添加job的时候,修改如下的代码形式
修改前
from apscheduler.schedulers.blocking import BlockingScheduler
from apscheduler.triggers.cron import CronTrigger
sched.add_job(get_hkex_data, 'cron', day_of_week='mon-fri', hour='15', minute="*", second="0") # 根据需要进行设置
修改后
from apscheduler.schedulers.blocking import BlockingScheduler
from apscheduler.triggers.cron import CronTrigger
trigger = CronTrigger(day_of_week='mon-fri', hour='15', minute="*", second="0")
sched.add_job(job_function, trigger) # 根据需要进行设置