windows 下为Python安装redis

最近在看《redis实战》,里面的redis示例都是Python写的,先将环境整好

启动redis

redis-server.exe  redis.conf

安装了python2.7

安装了pip

安装redis python客户端

1
pip install redis

查看安装是否成功

扫描二维码关注公众号,回复: 2268371 查看本文章
1
pip list

测试

新建hello.py

1
2
3
4
import redis
r = redis.Redis(host= '127.0.0.1' ,port=6609,db=0)
r. set ( 'hello' , 'world' )
print(r. get ( 'hello' ))

或者在控制台直接测试

猜你喜欢

转载自blog.csdn.net/yuer2008200820008/article/details/80842541