通常我可以用 Ctrl+C 打断东西,但有时当我使用线程时它不起作用——下面的例子。
Python 2.7.1+ (r271:86832, Apr 11 2011, 18:13:53)
[GCC 4.5.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import time
>>> time.sleep(100)
^CTraceback (most recent call last):
File "<stdin>", line 1, in <module>
K eyboardInterrupt
>>> import Queue
>>> q = Queue.Queue(maxsize=3)
>>> q.put(0)
>>> q.put(1)
>>> q.put(2)
>>> q.put(3)
^C^C^C^C^C^C^C^C
^C^C^C
^C^C
^C
@*#()#@#@$!!!!!
编辑: 有没有办法回到口译员那里?到目前为止的解决方案完全杀死 python 和你现有的命名空间..