原因是:
It looks like you need to flush stdout periodically (e.g. sys.stdout.flush()). In my testing Python doesn't automatically do this even with print until the program exits.
所以,
解决办法之一:加-u
nohup python -u Bilstm-My-Exp-Char.py --training 1 --char_base 1 --window 5 --rnn_active relu --data_root ../../wangzhen/bilstm/ --load_embed 1 --model_pkl mdl5-15-14-30 > 5.txt 2>&1 &解决办法之二: sys.stdout.flush()
nohup sucks!

本文介绍了在使用Python进行输出操作时遇到的缓冲问题及其解决办法。文中提供了两种解决方案:一是通过添加-u标志来避免输出缓冲;二是通过调用sys.stdout.flush()函数来定期刷新标准输出。这两种方法都能有效解决输出不及时的问题。
767

被折叠的 条评论
为什么被折叠?



