Book Image

NumPy Cookbook

Book Image

NumPy Cookbook

Overview of this book

Today's world of science and technology is all about speed and flexibility. When it comes to scientific computing, NumPy is on the top of the list. NumPy will give you both speed and high productivity. "NumPy Cookbook" will teach you all about NumPy, a leading scientific computing library. NumPy replaces a lot of the functionality of Matlab and Mathematica, but in contrast to those products, it is free and open source. "Numpy Cookbook" will teach you to write readable, efficient, and fast code that is as close to the language of Mathematics as much as possible with the cutting edge open source NumPy software library. You will learn about installing and using NumPy and related concepts. At the end of the book, we will explore related scientific computing projects. This book will give you a solid foundation in NumPy arrays and universal functions. You will also learn about plotting with Matplotlib and the related SciPy project through examples. "NumPy Cookbook" will help you to be productive with NumPy and write clean and fast code.
Table of Contents (17 chapters)
NumPy Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Installing IPython


IPython can be installed in various ways depending on your operating system. For the terminal-based shell, there is a dependency on readline. The web notebook requires tornado and zmq.

In addition to installing IPython, we will install setuptools, which gives you the easy_install command. The easy_install command is the default, standard package manager for Python. pip can be installed once you have easy_install available. The pip command is similar to easy_install, and adds options such as uninstalling.

How to do it...

This section describes how IPython can be installed on Windows, Mac OS X, and Linux. It also describes how to install IPython and its dependencies with easy_install and pip, or from source.

  • Installing IPython and setup tools on Windows: A binary Windows installer for Python 2 or Python 3 is available on the IPython website. Also see http://ipython.org/ipython-doc/stable/install/install.html#windows.

    Install setuptools with an installer from http://pypi.python.org/pypi/setuptools#files. Then install pip; for instance:

    cd C:\Python27\scripts
    python .\easy_install-27-script.py pip
    
  • Installing IPython On Mac OS X: Install the Apple Developer Tools (Xcode) if necessary. Xcode can be found on the OSX DVDs that came with your Mac or App Store. Follow the easy_install/pip instructions, or the installing from source instructions provided later in this section.

  • Installing IPython On Linux: Because there are so many Linux distributions, this section will not be exhaustive.

    • On Debian, type the following command:

      su – aptitude install ipython python-setuptools
      
    • On Fedora, the magic command is as follows:

      su – yum install ipython python-setuptools-devel
      
    • The following command will install IPython on Gentoo:

      su – emerge ipython
      
    • For Ubuntu, the install command is as follows:

      sudo apt-get install ipython python-setuptools
      
  • Installing IPython with easy_install or pip: Install IPython and all the dependencies required for the recipes in this chapter with easy_install, using the following command:

    easy_install ipython pyzmq tornado readline
    

    Alternatively, you can first install pip with easy_install, by typing the following command in your terminal:

    easy_install pip
    

    After that, install IPython using pip, with the following command:

    sudo pip install ipython pyzmq tornado readline
    
  • Installing from source: If you want to use the bleeding edge development version, then installing from source is for you.

    1. Download the latest tarball from https://github.com/ipython/ipython/downloads.

    2. Unpack the source code from the archive:

      tar xzf ipython-<version>.tar.gz
      
    3. If you have Git installed, you can clone the Git repository instead:

      $ git clone https://github.com/ipython/ipython.git
      
    4. Go to the ipython directory:

      cd ipython
      
    5. Run the setup script. This may require you to run the command with sudo, as follows:

      sudo setup.py install
      

How it works...

We installed IPython using several methods. Most of these methods install the latest stable release, except when you install from source, which will install the development version.