python版本:2.7
首先需要先安装redis模块:
wget https://pypi.python.org/packages/source/r/redis/redis-2.10.3.tar.gz
tar zxvf redis-2.10.3.tar.gz
cd redis-2.10.3
python setup.py install
备注:安装方法可以参考INSTALL文件内容
#cat INSTALL
Please use
python setup.py install
and report errors to Andy McCurdy (sedrik@gmail.com)
然后开始导入redis模块
[root@test ~/python]#python
Python 2.7.12 (default, Jun 1 2018, 14:00:01)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-18)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import redis
>>>