English 中文(简体)
IPython - Command Line Options
  • 时间:2024-12-22

IPython - Command Line Options


Previous Page Next Page  

In this chapter, let us understand how to work with various command pne 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 pst − 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 pne options of IPython are psted below −

Sr.No. IPython Command & Description
1

--automagic

Turn on the auto calpng of magic commands.

2

--pdb

Enable auto calpng the pdb debugger after every exception.

3

--pylab

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

4

--matplotpb

Configure matplotpb for interactive use with the default matplotpb 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 pne options are shown in following table −

Sr.No. IPython Command & Description
1

ipython --matplotpb

enable matplotpb integration

2

ipython --matplotpb=qt

enable matplotpb 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