Installation requirements

Let's take a look at the various requirements we need to set up before we proceed.

Using Python distributions

The three most important Python modules you need for this book are NumPy, IPython, and matplotlib; in this book, the code is based on the Python 3.4/2.7- compatible version, NumPy version 1.9, and matplotlib 1.4.3. The easiest way to install these requirements (and more) is to install a complete Python distribution, such as Enthought Canopy, EPD, Anaconda, or Python (x,y). Once you have installed any one of these, you can safely skip the remainder of this section and should be ready to begin.

Note

Note for Canopy users: You can use the Canopy GUI, which includes an embedded IPython console, a text editor, and IPython notebook editors. When working with the command line, for best results use the Canopy Terminal found in Canopy's Tools menu.

Note for Windows OS users: Besides the Python distribution, you can also install the prebuilt Windows python extended packages from Ghristoph Gohlke's website at http://www.lfd.uci.edu/~gohlke/pythonlibs/

Using Python package managers

You can also use Python package managers, such enpkg, Conda, pip or easy_install, to install the requirements using one of the following commands; replace numpy with any other package name you'd like to install, for example, ipython, matplotlib and so on:

$ pip install numpy
$ easy_install numpy
$ enpkg numpy # for Canopy users
$ conda install numpy # for Anaconda users

Using native package managers

If the Python interpreter you want to use comes with the OS and is not a third-party installation, you may prefer using OS-specific package managers such as aptitude, yum, or Homebrew. The following table illustrates the package managers and the respective commands used to install NumPy:

Package managers

Commands

Aptitude

$ sudo apt-get install python-numpy

Yum

$ yum install python-numpy

Homebrew

$ brew install numpy

Note that, when installing NumPy (or any other Python modules) on OS X systems with Homebrew, Python should have been originally installed with Homebrew.

Detailed installation instructions are available on the respective websites of NumPy, IPython, and matplotlib. As a precaution, to check whether NumPy was installed properly, open an IPython terminal and type the following commands:

 In [1]: import numpy as np 
 In [2]: np.test()

If the first statement looks like it does nothing, this is a good sign. If it executes without any output, this means that NumPy was installed and has been imported properly into your Python session. The second statement runs the NumPy test suite. It is not critically necessary, but one can never be too cautious. Ideally, it should run for a few minutes and produce the test results. It may generate a few warnings, but these are no cause for alarm. If you wish, you may run the test suites of IPython and matplotlib, too.

Note

Note that the matplotlib test suite only runs reliably if matplotlib has been installed from a source. However, testing matplotlib is not very necessary. If you can import matplotlib without any errors, it indicates that it is ready for use.

Congratulations! We are now ready to begin.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.116.14.245