python强制停止循环mac,在Mac上的终端中停止python

Using python in terminal on a Mac, type

ctrl-z

will stop the python, but not exit it, giving output like this:

>>>

[34]+ Stopped python

As you can see, I have stopped 34 python calls.

Although I could use

>>> exit()

to exit python, the questions are:

Is there a short-key to really exit (not just stop) python in terminal? and, why

ctrl-c

does NOT work?

How do I kill all the stopped python?

BTW, how could I type 'ctrl-c' and other hotkeys with a keyboard look?

Thanks!

解决方案

CTRL+d -> Defines EOF (End of File).

CTRL+c -> Will terminate most jobs.

If, however you have written a python wrapper program that calls other python programs in turn, Ctrl-c will only stop the the job that is currently running. The wrapper program will keep running. Worst case scenario, you can do this:

Open up: Applications -> Utilities -> Activity Monitor, Find the process labeled as python, highlight it in the activity monitor then click on "Quit Process".

These three suggestions should work for most situations where you want a program to stop.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值