python - 始终以 pylab 等于 inline 的方式启动 ipython,但有时将其关闭

标签 python configuration alias ipython

是否有关于如何启动 IPython shell 的任何约定或配置设置?例如,当我启动 IPython 时,我几乎总是以 pylab --inline 启动它。一种方法是创建别名,例如 alias ipython="ipython --pylab inline"。但是,我认为一旦我决定创建和使用别名,就不可能使用不同的选项(除了 inline 选项)启动 shell。

那么,是否可以始终使用 pylab=inline 选项启动 shell,但仍然在不需要它时将其关闭(或者更正确地说,每当我想避免它时) ?

(请勿创建具有不同名称的别名,例如 ipyipyWithPylab。)

谢谢。

最佳答案

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/

相关文章:

python - 在 keras 中使用额外输入加载自定义损失

python - 如果脚本不在主文件夹中,Cron 不会运行 Python 脚本

c - 为 Windows x64 构建 openSSL

c# - 如何在 C# 中使用应用程序配置文件?

sql - 别名上的 JOIN 语句 - SQL Server

sql - 为什么我的 As400 无法从新创建的成员别名中进行选择?

python - 手动分析程序

c++ - Python + alglib + NumPy : how to avoid converting arrays to lists?

c# - CreateLogger() 之前被调用过,只能调用一次

dart - 在已发布的 Flutter/Dart 包中重构参数名称时如何保持向后兼容性?