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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM