IPython – Command Line Options


IPython – Command Line Options


”;


In this chapter, let us understand how to work with various command line options in IPython.

Invoking IPython Program

You can invoke an IPython program using the following options −

C:python36> ipython [subcommand] [options] [-c cmd | -m mod | file] [--] [arg]

The file option is a Python script with .py extension. If no other option is given, the script is executed and command prompt reappears.

C:python36>ipython hello.py
Hello IPython
welcome to interactive computing

Subcommands and Parameters

An IPython command accepts the following subcommand options −

  • Profile − Create and manage IPython profiles.

  • Kernel − Start a kernel without an attached frontend.

  • Locate − Print the path to the IPython dir.

  • History − Manage the IPython history database.

An IPython profile subcommand accepts the following parameters −

  • ipython profile create myprofile − Creates a new profile.

  • ipython profile list − Lists all available profiles.

  • ipython locate profile myprofile − Locates required profile.

To install new IPython kernel, use the following command −

Ipython kernel –install –name

To print the path to the IPython dir, use the following command −

C:python36>ipython locate myprofile
C:Usersacer.ipython

Besides, we know that −

  • The history subcommand manages IPython history database.

  • The trim option reduces the IPython history database to the last 1000 entries.

  • The clear option deletes all entries.

Some of the other important command line options of IPython are listed below −

Sr.No. IPython Command & Description
1

–automagic

Turn on the auto calling of magic commands.

2

–pdb

Enable auto calling the pdb debugger after every exception.

3

–pylab

Pre-load matplotlib and numpy for interactive use with the default matplotlib backend.

4

–matplotlib

Configure matplotlib for interactive use with the default matplotlib backend.

5

–gui=options

Enable GUI event loop integration with any of (”glut”, ”gtk”, ”gtk2”,”gtk3”, ”osx”, ”pyglet”, ”qt”, ”qt4”, ”qt5”, ”tk”, ”wx”, ”gtk2”, ”qt4”).

The sample usage of some of the IPython command line options are shown in following table −

Sr.No. IPython Command & Description
1

ipython –matplotlib

enable matplotlib integration

2

ipython –matplotlib=qt

enable matplotlib integration with qt4 backend

3

ipython –profile=myprofile

start with profile foo

4

ipython profile create myprofile

create profile foo w/ default config files

5

ipython help profile

show the help for the profile subcmd

6

ipython locate

print the path to the IPython directory

7

ipython locate profile myprofile

print the path to the directory for profile `myprofile`

Advertisements

”;

Leave a Reply

Your email address will not be published. Required fields are marked *