flask_apscheduler Unable to determine the name of the local timezone

最近在配置flask_apscheduler遇到了问题:

ValueError: Unable to determine the name of the local timezone – you
must explicitly specify the name of the local timezone. Please refrain
from using timezones like EST to prevent problems with daylight saving
time. Instead, use a locale based timezone name (such as
Europe/Helsinki).

解决方法是添加环境变量:

import os
os.environ['TZ']= 'Asia/Shanghai'
发布了77 篇原创文章 · 获赞 33 · 访问量 7万+

猜你喜欢

转载自blog.csdn.net/fjh1997/article/details/105323343