用nohup执行python程序时,print没法输出

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

发现nohup.out中显示不出来python程序中print的东西。python

这是由于python的输出有缓冲,致使nohup.out并不可以立刻看到输出。.net

python 有个-u参数,使得python不启用缓冲。get

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

相关文章
相关标签/搜索