问题描述
训练时候的输出日志要么没有,要么就是输出了一点点就没有了(突然不输出内容了),记得之前也出现过训练中途突然日志不打印了,当时以为服务器原因可能被挤掉了。但这次是还没开始并且试过很多次了。
所用语句
python -u main.py > test2.out 2>&1 &
或者python main.py > test2.out 2>&1 &
或者nohup python main.py > test2.out 2>&1 &
或者nohup python main.py > test2.out &
或者 python main.py >> test2.out &
都试过了,时间也等了很长,还是没有输出
解决
后来发现是因为之前开了多线程,那些端口一直没有被释放,导致无端口可用,一直程序被死锁。
解决查看服务器当前所运行的程序有哪些:
ps -ef |grep python
看到开多线程的运行完毕的代码kill掉
pkill xxx.py 杀掉所有的xxx.py的python文件