python example_new_datasets.py 改成后台运行不中断的ubuntu命令

Erstellt am: 27. Oktober 2026

Beantwortet mit GPT-5.6 Thinking von Chat01

Frage

python example_new_datasets.py 改成后台运行不中断的ubuntu命令

Gedanke

Worked for a couple of seconds

Antwort

Ubuntu 上可以这样后台运行,退出 SSH 后也不会中断:

bash
nohup python example_new_datasets.py > example_new_datasets.log 2>&1 &

查看是否还在运行:

bash
ps aux | grep example_new_datasets.py

实时看日志:

bash
tail -f example_new_datasets.log

如果你想更稳一点,可以加 disown:

bash
nohup python example_new_datasets.py > example_new_datasets.log 2>&1 & disown

如果你用的是 Conda/虚拟环境,先激活对应环境,再执行上面的命令即可。

Diesen Q&A teilen