IPython and IPython Notebook
Christian Hill · Cambridge University Press eBooks · 2015
The IPython shell and the related interactive, browser-based IPython Notebook provide a powerful interface to the Python language. IPython has several advantages over the native Python shell, including easy interaction with the operating system, introspection and tab completion. IPython Notebook increasingly is being adopted by scientists to share their data and the code they write to analyze it in a standardized manner that aids reproducibility and visualization. IPython Installing IPython Comprehensive details on installing IPython are available at the IPython website: see http://ipython.org/install.html, but a summary is provided here. IPython is included in the Continuum Anaconda and Enthought Canopy Python distributions. To update to the current version within Anaconda, use the conda package manager: conda update conda conda update ipython With Canopy, use enpkg ipython If you are not using these distributions but already have Python installed, there are several alternative options. If you have the pip package manager: pip install ipython pip install “ipython[notebook]” It is also possible to manually download the latest IPython version from the github repository at https://github.com/ipython/ipython/releases and compile and install from its top-level source directory with python setup.py install Using the IPython shell To start an interactive IPython shell session from the command line, simply type ipython. You should be greeted with a message similar to this one: Python 3.3.5 |Anaconda 2.0.1 (x86_64)| (default, Mar 10 2014, 11:22:25) Type “copyright”, “credits” or “license” for more information. IPython 2.1.0 – An enhanced Interactive Python. Anaconda is brought to you by Continuum Analytics. Please check out: http://continuum.io/thanks and https://binstar.org ? -> Introduction and overview of IPython's features. %quickref -> Quick reference. help -> Python's own help system. object? -> Details about ‘object’, use ‘object??’ for extra details. In [1]: (The precise details of this message will depend on the setup of your system.) The prompt In [1]: is where you type your Python statements and replaces the native Python >>> shell prompt. The counter in square brackets increments with each Python statement or code block. For example, In [1]: 4+5 Out[1]: 9 In [2]: print (1) 1 In [3]: for i in range(4): …: print (i, end=’’) …: 0123 In [4]: To exit the IPython shell, type quit or exit. Unlike with the native Python shell, no parentheses are required.