Sunday, 4 September 2011

How to install Numpy, Scipy and other python packages in Windows.

This is a short overview/guide on how to install Python packages in Windows, such as Numpy, which is an amazing tool for data manipulation.

For working with Numpy and Scipy, Python27 32-bit (first download link!) is required. Scipy[ and Numpy both have installers for windows and are extremely painless to install (compared to trying to install both for the first time on Mac OS X! :D)

To install packages, setuptools is required. This will install easy_install.

If you have added python to your system variables as described in my previous blog post, packages can be installed as follows. First we will install pip, as this is a newer and better package manager than 'easy_install'. In this example I will show how to install uncertainties, a great package I like to use for handling standard deviations in calculations (works with numpy too!).

cd C:\Python27\scripts
python .\easy_install-27-script.py pip
python .\pip-2.7-script.py install uncertainties

Type:
python .\pip-2.7-script.py help
For an overview of pip commands.

I'm sure there is a better way to input those commands, but I'm not all too familiar yet with cmd/powershell and python in Windows :) However, I can confirm that this works fine!

Again, I suggest installing 'nose' to test and validate your Numpy and Scipy installations:

python .\pip-2.7-script.py install nose

With nose, you can test if your numpy/scipy installation is correctly installed by opening a python terminal and typing:

import numpy
numpy.test('1','10')
import scipy
scipy.test('1','10')

No comments:

Post a Comment