我正在尝试为IPython qtconsole (v3.0.0)设置一个自定义横幅。在我的配置文件配置中,我设置了c.IPythonWidget.banner = u'Custom Banner',然后启动ipython qtconsole --profile=myprof。我得到的是我的自定义横幅预先挂在常规横幅上:
Custom BannerPython 2.7.5 (default, Mar 9 2014, 22:15:05)
Type "copyright", "credits" or "license" for more information.
IPython 3.0.0 -- 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.
%guiref -> A brief reference about the graphical user interface.
IPython profile: myprof
In [1]: 我怎样才能只打印我的横幅,例如
Custom Banner
IPython profile: myprof
In [1]: 谢谢。
发布于 2015-05-13 04:40:04
这并不理想,但是我能够通过在IPython源代码的core/usage.py模块中设置default_gui_banner=""来抑制默认横幅。我找不到任何不修改源代码的方法(这很难看),所以如果有人有更好的方法,我洗耳恭听。
发布于 2015-06-30 02:43:12
您不想要的消息将作为内核标语的一部分打印出来(它是从内核的shell中获得的)。在使用/连接到其他地方的内核之前,通过将外壳的banner1属性设置为空字符串,我能够避免打印它:
from IPython.qt.inprocess import QtInProcessKernelManager
kernel_manager = QtInProcessKernelManager()
kernel_manager.start_kernel()
kernel_manager.kernel.shell.banner1 = ""我只使用过/测试过IPython Qt的东西,所以这可能不适用于其他内核。
https://stackoverflow.com/questions/30175518
复制相似问题