IPython - 禁用欢迎信息

10

每次我进入 ipython 模式时,ipython 都会向我发出以下消息:

WARNING: Attempting to work in a virtualenv. If you encounter 
problems, please install IPython inside the virtualenv.
Python 2.7.6 (default, Mar 22 2014, 22:59:56) 
Type "copyright", "credits" or "license" for more information.

IPython 1.2.1 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

问候别人固然重要,但它占据了我大部分的shell屏幕,并且我必须使用clean命令来将它们移除。

我应该如何通过配置文件禁用这个欢迎消息?

3个回答

8

您可以使用

ipython --no-banner

或在配置文件中设置

c.TerminalIPythonApp.display_banner = False

3

编辑IPython配置文件

编辑您的配置文件并添加以下内容:

最初的回答
c.TerminalIPythonApp.display_banner = False

默认配置文件位于/home/<user>/.ipython/profile_default/ipython_config.py
IPython配置文档可以在这里找到。
更新默认配置文件:
如果文件不存在,请创建新的配置文件;或者使用已有的文件进行修改。
ipython locate profile

最初的回答:要查看当前配置文件位置,请执行以下操作:

查看当前配置文件位置。


2

只需使用:

ipython console

如果您有这个需求,那么您将得到它。


真的吗?你使用的是哪个版本的IPython? - ljk321
IPython 1.2.1 -- 一种增强的交互式Python。 - user2879704
1
哇...这有点老了,伙计。我正在使用IPython 3.0.0。也许你应该考虑升级它。 - ljk321
它有效了,谢谢。但是WARNING语句没有消失。可以使用这篇文章修复它,https://dev59.com/o2ox5IYBdhLWcg3wsGWC - user2879704

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接