一、安装redis-py的方法
使用pip install安装redis-py
1C:\Users\BigJun>pip3 install redis 2Collecting redis 3 Downloading https://files.pythonhosted.org/packages/3b/f6/7a76333cf0b9251ecf49efff635015171843d9b977e4ffcf59f9c4428052/redis-2.10.6-py2.py3-none-any.whl (64kB) 4 100% |████████████████████████████████| 71kB 180kB/s 5Installing collected packages: redis 6Successfully installed redis-2.10.6
二、redis-py的使用方法(其他API和jedis类似,不一一测试了)
1import redis 2client = redis.StrictRedis(host='192.168.131.132', port=6379) 3key = "hello" 4setResult = client.set(key, "python-redis") 5print(setResult) 6value = client.get(key).decode('utf8') 7print(value)输出为:C:\mysoftware\Python3\python3.exe C:/mysoftware/pycharm/littlepig/little_pig.pyTruepython-redis