最近在看《redis實戰》,里面的redis示例都是Python寫的,先將環境整好
啟動redis
redis-server.exe redis.conf
安裝了python2.7
安裝了pip
安裝redis python客戶端
pip install redis
查看安裝是否成功
pip list
測試
新建hello.py
import redis r = redis.Redis(host='127.0.0.1',port=6609,db=0) r.set('hello','world') print(r.get('hello'))
或者在控制台直接測試