One - One Code All

Blog Content

python执行-u参数输出无缓冲

Python   2007-12-22 15:18:01

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

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

这是因为python的输出有缓冲,导致nohup.out并不能够马上看到输出。

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

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


上一篇:如何找到我的Python site-packages目录的位置?
下一篇:python包的版本升级与安装

The minute you think of giving up, think of the reason why you held on so long.