Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ImportError: No module named redis

I have installed redis using sudo apt-get install redis-server command but I am receiving this error when I run my Python program: ImportError: No module named redis

Any idea what's going wrong or if I should install any other package as well? I am using Ubuntu 13.04 and I have Python 2.7.

like image 273
Mona Jalal Avatar asked Oct 10 '13 06:10

Mona Jalal


1 Answers

To install redis-py, simply:

$ sudo pip install redis 

or alternatively (you really should be using pip though):

$ sudo easy_install redis 

or from source:

$ sudo python setup.py install 

Getting Started

>>> import redis >>> r = redis.StrictRedis(host='localhost', port=6379, db=0) >>> r.set('foo', 'bar') True >>> r.get('foo') 'bar' 

Details:https://pypi.python.org/pypi/redis

like image 118
sinceq Avatar answered Sep 23 '22 16:09

sinceq