时区 显式的设置时区很有必要 python 设置全局时区 在程序开头加上如下代码 1 2 3 4 5import os import time os.environ['TZ'] = 'Asia/Shanghai' time.tzset()