一种方法:nohup python xxx.py > python.log 2>&1 &
另一种方法:安装 tmux,方法见https://jingyan.baidu.com/article/d8072ac4b37536ec95cefd95.html
在tmux中开session,运行程序,客户端的离开不会导致服务器端的运行,因为可以通过tmux复原。
tmux new-session -s python-program #开session
tmux a -t python-program #复原session