每次我输入exit()
都会弹出确认退出的提示,真的很烦人。当然我想退出啊!否则我也不会写exit()
了!
有没有办法覆盖IPython的默认行为,使其在退出时不提示?
Ctrl-D
键退出IPython时无需确认,请在IPython 0.11中添加c.TerminalInteractiveShell.confirm_exit = False
到你的配置文件*中。ipython profile create
创建一个。$HOME/.ipython/profile_default/ipython_config.py
。$IPYTHONDIR/profile_default/ipython_config.py
。 - smac89--no-confirm-exit
ORMake sure the directory exists (or run ipython profile create
to create it) and add these lines to $HOME/.ipython/profile_default/ipython_config.py:
c = get_config()
c.TerminalInteractiveShell.confirm_exit = False
~/.config/ipython/profile_default/ipython_config.py
以匹配freedesktop.org。适用于1.2.1版本。 - Ciro Santilli OurBigBook.com只需键入带有大写字母 E
的Exit
即可。
或者使用以下命令启动IPython:
$ ipython -noconfirm_exit
或者对于较新版本的IPython:
$ ipython --no-confirm-exit
ipythonrc
配置文件中设置:confirm_exit 0
。 - nye17我喜欢这个配置建议,但在我学习之前,我已经开始使用“退出”键组合。
Ctrl+\
或者
Ctrl+4
SIGQUIT
信号,没有给IPython进程清理自己的机会。 - georgexsh
exit
命令不会再询问是否确认退出。(但是若你意外按下Ctrl-d仍然会提示确认退出) - Thomas K