2

Is there any convention or configuration setting for how to start IPython shell? For example, when I start IPython, I almost always start it with pylab --inline. One approach is to create an alias, such as alias ipython="ipython --pylab inline". However, I think it's impossible to start the shell with different options (other than inline option) once I decide to create and use the alias.

So is it feasible to always start the shell with pylab=inline option, but still to toggle it off whenever I don't need it (or more correctly, whenever I want to avoid it)?

(Don't suggest to create an alias with different names, such as ipy or ipyWithPylab, please.)

Thanks.

Blaszard
  • 30,954
  • 51
  • 153
  • 233

1 Answers1

2

ipython qtconsole --help-all says :

--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.

so c.IPKernelApp.matplotlib='inline'in your *_config.py(probably in ~/.ipython/profile_default) will work. Please read how to configure IPyton, usually doc explain a lot of things on how to do stuff.

Be careful though, there is a difference between having inlines figures and having a %pylab kernel. It is not possible to un-pylab a kernel (like it is impossible in python to un-import a module). With 1.0 and above and recent matplotlib, you can toggle inline/not inline with the %matplotlib <backend> magic.

Matt
  • 27,170
  • 6
  • 80
  • 74
  • Thanks. Actually, I did try it, but it didn't work. And I just found that I don't have QT4 installed in my OS X system (which I had before, not sure when it's gone). However, starting the shell with `ipython --pylab inline` works, despite it spitting out an warning, while starting it with configuration file setting doesn't... I don't know the reason, but I think it's the best, at least right now, to bother to starting it with `--pylab inline` option. Thanks a lot for your answer, though. – Blaszard Nov 13 '13 at 05:57