每次我输入exit()
时,都会提示确认退出,这真是令人恼火;我当然想退出!否则我就不会写exit()
了!!
是否有一种方法来覆盖IPython的默认行为,使其退出没有提示?
如果你也想让Ctrl-D
不经确认退出,在ippython 0.11中,添加c.TerminalInteractiveShell.confirm_exit = False
到你的配置文件*.
如果你还没有配置文件,运行ipython profile create
创建一个。
如果你在Django shell中工作,请注意这个票据。
*配置文件位于:$HOME/.ipython/profile_default/ipython_config.py
在ippython 0.11或更高版本中,
- 使用
--no-confirm-exit
或 运行 - 通过' Exit '退出而不是control-D OR
确保目录存在(或运行
ipython profile create
创建它),并将这些行添加到$HOME/.ipython/profile_default/ipython_config.py:c = get_config() c.TerminalInteractiveShell.confirm_exit = False
输入Exit
,大写E
。
或者,用:
启动ippython$ ipython -noconfirm_exit
或者对于新版本的IPython:
$ ipython --no-confirm-exit
我喜欢这些配置建议,但是在我学会它们之前,我已经开始使用"Quit"组合键了。
Ctrl+
或
Ctrl+4
这会杀死正在运行的程序。没时间问确认问题了