链接 https://blog.csdn.net/u010158659/article/details/81671901 -u强制python不使用IO缓冲区,运行时使用 python -u main.py 2>&1 | tee xxx.log 就没有这个问题了