There are various ways in which one can access and install Python and its packages. Here we will discuss a couple of them.
Anaconda is a popular Python distribution consisting of more than 195 popular Python packages. Installing Anaconda automatically installs many of the packages discussed in the preceding section, but they can be accessed only through an IDE called Spyder (more on this later in this chapter), which itself is installed on Anaconda installation. Anaconda also installs IPython Notebook and when you click on the IPython Notebook icon, it opens a browser tab and a Command Prompt.
Anaconda can be downloaded and installed from the following web address: http://continuum.io/downloads
Download the suitable installer and double click on the .exe
file and it will install Anaconda. Two of the features that you must check after the installation are:
Search for them in the "Start" icon's search, if it doesn't appear in the list of programs and files by default. We will be using IPython Notebook extensively and the codes in this book will work the best when run in IPython Notebook.
IPython Notebook can be opened by clicking on the icon. Alternatively, you can use the Command Prompt to open IPython Notebook. Just navigate to the directory where you have installed Anaconda and then write ipython notebook
, as shown in the following screenshot:
You can download a Python version that is stable and is compatible to the OS on your system. The most stable version of Python is 2.7.0. So, installing this version is highly recommended. You can download it from https://www.python.org/ and install it.
There are some Python packages that you need to install on your machine before you start predictive analytics and modelling. This section consists of a demo of installation of one such library and a brief description of all such libraries.
There are several ways to install a Python package. The easiest and the most effective is the one using pip
. As you might be aware, pip
is a package management system that is used to install and manage software packages written in Python. To be able to use it to install other packages, pip
needs to be installed first.
The following steps demonstrate how to install pip
. Follow closely!
pip-7.0.3.tar.gz
file and unzip in the folder where Python is installed. If you have Python v2.7.0 installed, this folder should be C:Python27
:pip-7.0.3
is created. Opening that folder will take you to the screen similar to the one in the preceding screenshot.C:Python27pip-7.0.3
using the following command:cd C:Python27pip-7.0.3.
pip (setup.py)
resides. Write the following command to install pip:
python setup.py install
Once pip
is installed, it is very easy to install all the required Python packages to get started.
The following are the steps to install Python packages using pip
, which we just installed in the preceding section:
C:Python27
.pip install package-name
python -c "import pandas"
If this doesn't throw up an error, then the package has been installed successfully.