我想创建一个与 IPython 执行相同操作的配置文件--pylab
“用手”标记。为了实现这一目标,脚本的内容应该是什么(包导入、名称空间指定、设置等)?
作为替代方案,我还想知道是否有一种方法可以检查--pylab
当前 IPython 会话启动时设置了标志。
简单地做from matplotlib.pylab import *
不起作用,也不行%pylab
(因为个人资料中似乎不允许使用魔法)。
深入研究帮助和手册页($ ipython --help-all
然后搜索“pylab”)显示:
--pylab=<CaselessStrEnum> (InteractiveShellApp.pylab) # mean is an alias for
--InteractiveShellApp.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.
--InteractiveShellApp.pylab_import_all=<Bool>
Default: True
If true, IPython will populate the user namespace with numpy, pylab, etc.
and an ``import *`` is done from numpy and pylab, when using pylab mode.
When False, pylab mode should not import any names into the user namespace.
So c.InteractiveShellApp.pylab='auto'
无论如何配置 http://ipython.org/ipython-doc/stable/config/overview.html#configuration-objects-and-files or profile http://ipython.org/ipython-doc/stable/config/overview.html#profiles你正在加载就可以了。
(同意安德鲁的观点,像这样隐藏是不合时宜的。)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)