linux nohup python 后台运行无输出问题

参考:https://blog.csdn.net/zj360202/article/details/78894512

nohup python test.py &

nohup python test.py 2>&1 &

nohup python test.py > test.out 2>&1 &

上面三种方式无论在nohup.out 或test.out都看不到数据结果,这是因为python执行有缓存输出。

解决:使用-u参数

nohup python -u test.py > test.out 2>&1 &

猜你喜欢

转载自www.cnblogs.com/t-road/p/11994227.html