This book covers the use of Redis, an in-memory database/data structure server.

open all | close all

A.3.3 Installing Python on Windows

If you already have Python 2.6 or 2.7 installed, you’re fine. If not, you’ll want to download
the latest version of Python 2.7, because that’s the most recent version of Python
that has support for the Redis library. Go to http://www.python.org/download/ and
select the most recent version of the 2.7 series that’s available for Windows in either
the 32- or 64-bit version (again, depending on your platform). When Python is done
downloading, you can install it by double-clicking on the downloaded .msi file.

Assuming that you accepted all of the default options for installing Python 2.7,
Python should be installed in C:Python27. From here, you only need to install the
Python Redis library to be ready to use Redis with Python. If you’re using Python 2.6,
any time the book refers to Python27, you can instead use Python26.

To help you to install the Redis client library, you’ll use the easy_install utility
from the setuptools package. This is because you can easily download setuptools
from the command line. To get started, open a command prompt by going into the
Accessories program group in the Start menu and clicking on Command Prompt.
After you have a command prompt open, follow along with the next listing; it shows
how to download and install setuptools and the Redis client library.

Listing A.6Installing the Redis client library for Python on Windows

Start Python by itself in interactive mode.

Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit...
Type "help", "copyright", "credits" or "license" for more information.
>>> from urllib import urlopen

Import the urlopen factory function from the urllib module.

>>> data = urlopen('http://peak.telecommunity.com/dist/ez_setup.py')

Fetch a module that will help you install other packages.

>>> open('ez_setup.py', 'wb').write(data.read())

Write the downloaded module to a file on disk.

>>> exit()

Quit the Python interpreter by running the builtin exit() function.

C:Usersjosiah>c:python27python ez_setup.py

Run the ez_setup helper module.

Downloading http://pypi.python.org/packages/2.7/s/setuptools/...
Finished processing dependencies for setuptools==0.6c11

The ez_setup helper downloads and installs setuptools, which will make it easy to download and install the Redis client library.

C:Usersjosiah>c:python27python -m easy_install redis
Searching for redis
Finished processing dependencies for redis

Use setuptools’ easy_install module to download and install Redis.


*insert a tooltip/decription here*

Now that you have Python and the Redis client library installed, you should continue
with section A.4 to use Redis from Python for the first time.