禁用 IPython 退出确认
确实令人恼火的是,每次我输入 exit()
时,都会提示我确认退出;我当然想退出!否则,我就不会写 exit()
!!!
有没有办法覆盖 IPython 的默认行为,使其在没有提示的情况下退出?
It's really irritating that every time I type exit()
, I get prompted with a confirmation to exit; of course I want to exit! Otherwise, I would not have written exit()
!!!
Is there a way to override IPython's default behaviour to make it exit without a prompt?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
如果您还希望
Ctrl-D
在不确认的情况下退出,请在 IPython 0.11 中,将c.TerminalInteractiveShell.confirm_exit = False
添加到您的配置文件*。如果您还没有配置文件,请运行
ipython profile create
创建一个。如果您在 Django shell 中工作,请注意此票证。
* 配置文件位于:
$HOME/.ipython/profile_default/ipython_config.py
If you also want
Ctrl-D
to exit without confirmation, in IPython 0.11, addc.TerminalInteractiveShell.confirm_exit = False
to your config file *.If you don't have a config file yet, run
ipython profile create
to create one.Note this ticket if you're working within the Django shell.
* The config file is located at:
$HOME/.ipython/profile_default/ipython_config.py
在 ipython 版本 0.11 或更高版本中,
--no-confirm-exit
运行或确保目录存在(或运行
ipython profile create
来创建它)并将这些行添加到 $HOME/.ipython/profile_default/ipython_config.py:<前><代码>c = get_config()
c.TerminalInteractiveShell.confirm_exit = False
In ipython version 0.11 or higher,
--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:只需输入
Exit
,并使用大写的E
。或者,启动 IPython:
或者对于较新版本的 IPython:
just type
Exit
, with capitalE
.Alternatively, start IPython with:
Or for newer versions of IPython:
我喜欢配置建议,但在了解它们之前,我已经开始使用“退出”组合键。
或者
这只会杀死正在运行的程序。没有时间询问确认问题。
I like the config suggestions, but until I learned them I've started using "Quit" key combination.
or
This just kills what is running. No time to ask questions on confirmation.