是否有关于如何启动 IPython
shell 的任何约定或配置设置?例如,当我启动 IPython 时,我几乎总是以 pylab --inline 启动它。一种方法是创建别名,例如 alias ipython="ipython --pylab inline"
。但是,我认为一旦我决定创建和使用别名,就不可能使用不同的选项(除了 inline
选项)启动 shell。
那么,是否可以始终使用 pylab=inline 选项启动 shell,但仍然在不需要它时将其关闭(或者更正确地说,每当我想避免它时) ?
(请勿创建具有不同名称的别名,例如 ipy
或 ipyWithPylab
。)
谢谢。
最佳答案
ipython qtconsole --help-all
说:
--IPKernelApp.matplotlib=<CaselessStrEnum>
Default: None
Choices: ['auto', 'gtk', 'inline', 'osx', 'qt', 'qt4', 'tk', 'wx']
--IPKernelApp.pylab=<CaselessStrEnum>
Default: None
Choices: ['auto', 'gtk', 'inline', 'osx', 'qt', 'qt4', 'tk', 'wx']
Pre-load matplotlib and numpy for interactive use, selecting a particular
matplotlib backend and loop integration.
所以c.IPKernelApp.matplotlib='inline'
在你的*_config.py
(可能在 ~/.ipython/profile_default
)会起作用。请阅读how to configure IPyton ,通常文档会解释很多关于如何做事情的事情。
但要小心,内联数字和 %pylab
之间是有区别的。核心。无法取消 pylab 内核(就像在 python 中不可能取消导入模块一样)。使用 1.0 及更高版本和最近 matplotlib,您可以使用 %matplotlib <backend>
切换内联/非内联魔法。
关于python - 始终以 pylab 等于 inline 的方式启动 ipython,但有时将其关闭,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19902984/