版本1无法写入我的output.txt文件:
nohup python test.py &> output.txt &
但是版本2可以工作:
nohup python test.py &> output.txt
我需要拖尾 & 因为我想在命令行上执行其他任务!
&
解决了的: ... python -u ... 是答案。似乎这个附加选项可以防止python输出缓冲。
... python -u ...