解决python nohup linux 后台运行输出的问题
作者:mulangren1988 时间:2022-03-25 06:40:11
遇到问题
nohup python flush.py &
这样运行,生成了nohup.out文件,但是内容始终是空的,试了半天也不行。浪费了不少时间。
原因
python的输出又缓冲,导致out.log并不能够马上看到输出。
-u 参数,使得python不启用缓冲。
解决
nohup python -u flush.py > flush.log 2>&1 &
终于好了!
来源:https://blog.csdn.net/mulangren1988/article/details/60142418
标签:python,nohup,linux
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
python生成13位或16位时间戳以及反向解析时间戳的实例
2021-02-18 17:16:35
![](https://img.aspxhome.com/file/2023/5/75975_0s.jpg)
ASP中Cookies集合使用方法详解
2007-09-14 10:16:00
数字格式化转换
2010-08-03 12:22:00
python函数局部变量用法实例分析
2023-08-24 17:50:25
asp 存储过程分页代码第1/2页
2011-04-03 10:39:00
![](https://img.aspxhome.com/file/UploadPic/20112/5/201125112228776s.jpg)
python实现打砖块游戏
2023-11-09 21:27:15
网页常用特效整理:中级篇
2013-07-15 13:43:32
浅谈python 类方法/静态方法
2021-02-23 07:00:54
Python 如何手动编写一个自己的LRU缓存装饰器的方法实现
2022-08-04 13:06:10
浅析Python中的赋值和深浅拷贝
2021-09-10 14:30:14
![](https://img.aspxhome.com/file/2023/9/78549_0s.png)
一个ASPJPEG组件的asp类 CLASS
2008-03-11 12:22:00
Python读取ini配置文件传参的简单示例
2022-02-06 09:51:36
一行两列背景自适应的简单写法 DIV+CSS
2008-07-15 12:51:00
文章内链(标签)的一个思路
2009-10-31 19:03:00
php 参数过滤、数据过滤详解
2023-11-17 17:36:56
python/sympy求解矩阵方程的方法
2023-07-04 07:06:34
![](https://img.aspxhome.com/file/2023/0/83810_0s.jpg)
ASP分页技术详解
2007-08-13 15:25:00
![](https://img.aspxhome.com/file/UploadPic/20078/13/2007813153154844s.jpg)
使用Python写一个贪吃蛇游戏实例代码
2023-07-05 18:25:02
Python提示[Errno 32]Broken pipe导致线程crash错误解决方法
2022-12-02 02:20:42
python如何使用代码运行助手
2022-08-27 21:11:19
![](https://img.aspxhome.com/file/2023/4/89184_0s.png)