pyinstaller打包exe程序各种坑!!!

pyinstaller打包python成exe可执行程序,各种报错,各种坑,在次记录下

一、pyinstaller打包报错for real_module_name, six_moduleAttributeError: 'str' object has no attribute 'items'

升级版本

pip install -U --pre setuptools

或者:直接下载最新版 https://pypi.org/project/setuptools/

二、LookupError: No trigger by the name “interval” was found

这种报错是因为没有导入使用CronTrigger模块引起的,python环境运行没问题,但是pyinstaller打包就会出错,例如:

sched.add_job(foo, 'cron', day_of_week='0-6',hour=22,minute=10, id='1')

应该改成下面这样:

import time
from apscheduler.schedulers.background import BackgroundScheduler
from apscheduler.triggers.cron import CronTrigger

def foo():
    print(12349)


sched = BackgroundScheduler()
sched.start()

c1 = CronTrigger(day_of_week='0-6', hour=22, minute=41, second=30)
c2 = CronTrigger(day_of_week='0-6', hour=22, minute=41, second=33)
c3 = CronTrigger(day_of_week='0-6', hour=22, minute=41, second=36)
c4 = CronTrigger(day_of_week='0-6', hour=22, minute=41, second=39)

sched.add_job(foo, c1, day_of_week='0-6', id='1')
sched.add_job(foo, c2, day_of_week='0-6', id='2')
sched.add_job(foo, c3, day_of_week='0-6', id='3')
sched.add_job(foo, c4, day_of_week='0-6', id='4')
time.sleep(1000)

 其他: https://blog.csdn.net/weixin_42052836/article/details/82315118#2.spec%E6%96%87%E4%BB%B6%E9%85%8D%E7%BD%AE

https://blog.csdn.net/yourgreatfather/article/details/85618848

转载于:https://www.cnblogs.com/zhzhlong/p/10597409.html

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值