Install redis for pyton on windows

Downloan redis 2.7.4. The python interface to the reids key-value store. The url:https://github.com/andymccurdy/redis-py
installation the redis for python.

  • to install redis-py: $sudo pip install redis
  • alternatively: $sudo easy_install reids
  • or from source: $sudo python setup.py intall

If you are windows user, put the redis package to $(python path)/lib and install with python setup.py install.
when you input ‘import redis’ and no syntaxerror. That’s mean reids is OK.

then start with redis:
when you start redis with python, you should start redis server, you can setup the redis in local, start redis-server. If your python run with ‘ConnectionError: Error 10061 connecting 127.0.0.1:6379′, that’s mean your redis server has problem.
OK, let’s run python with redis.

import redis
r = redis.StrictRedis(host = '127.0.0.1', port = 6379, db = 0);
r.set('name','kem')
print(r.get('name'))

result:kem

redis server:

你可能感兴趣的:(redis)