每次输入exit()
时,我都会收到确认退出的提示,这真是令人恼火;当然我要退出!否则,我不会写exit()
!!!
有没有办法覆盖IPython的默认行为,让它在没有提示的情况下退出?
答案 0 :(得分:113)
如果您还希望Ctrl-D
在没有确认的情况下退出,请在IPython 0.11中将c.TerminalInteractiveShell.confirm_exit = False
添加到您的配置文件*。
如果您还没有配置文件,请运行ipython profile create
创建一个。
如果你在Django shell中工作,请注意this ticket。
*配置文件位于:$HOME/.ipython/profile_default/ipython_config.py
答案 1 :(得分:35)
在ipython版本0.11或更高版本中,
--no-confirm-exit
或确保目录存在(或运行ipython profile create
来创建它)并将这些行添加到$ HOME / .ipython / profile_default / ipython_config.py:
c = get_config()
c.TerminalInteractiveShell.confirm_exit = False
答案 2 :(得分:16)
只需输入Exit
,首都为E
。
或者,使用以下命令启动IPython:
$ ipython -noconfirm_exit
或者对于较新版本的IPython:
$ ipython --no-confirm-exit
答案 3 :(得分:4)
我喜欢配置建议,但在我了解它们之前,我已经开始使用" Quit"关键组合。
Ctrl+\
或
Ctrl+4
这只会杀死正在运行的东西。没时间在确认时提问。