杀死一个python进程 [英] Kill a python process

查看:191
本文介绍了杀死一个python进程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写了一个python脚本,但不小心在脚本中放入了一个无限的while循环.

I wrote a python script but accidentally put an infinite while loop in my script.

我该如何终止进程?我尝试了ctrl+c,但是没有成功.

How do I kill the process? I've tried ctrl+c but with no success.

还有其他选择可以尝试吗?

Are there any other option to try?

我在使用python 2.7的Mac Os X 10.7.2上

I'm on Mac Os X 10.7.2 with python 2.7

推荐答案

ps a以获取您的进程的PID. kill -9 <pid>向其发送不可阻塞的SIGKILL信号.

ps a to get the PID of your process. kill -9 <pid> to send it the unblockable SIGKILL signal.

请注意,我前面只有一个Linux机器可以测试,因此OS X命令可能略有不同.

Note that I only have a Linux box in front of me to test, so the OS X commands may be slightly different.

这篇关于杀死一个python进程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆