Ubuntu上面安装Redis Python

时间:2023-03-09 08:00:31
Ubuntu上面安装Redis Python

Ubuntu上面安装Redis Python

1,下载redis源码https://redis.io/download,下载地址:http://124.205.69.169/files/A0920000066BC41D/download.redis.io/releases/redis-4.0.8.tar.gz

2,在Ubuntu上面解压 tar -xzf redis-4.0.8.tar.gz

cd redis-4.0.8

make '编译Redis

sudo make install  ‘安装Redis

redis-server redis.conf  '启动Reids服务器

3,python已经默认安装了;

4,为Python安装Redis客户端

wget -q http://peak.telecommunity.com/dist/ez_setup.py

sudo python ez_setup.py

如果出现403 SSL is required,vi修改一下,把http修改为https

用easy_install 安装redis , hiredis出现问题;

改用pip进行redis,hiredis安装;

5,安装pip

sudo apt-get install python-pip

6,使用pip安装hiredis

sudo pip install hiredis

7,使用pip安装redis失败

8,安装git

sudo apt-get install git

9,使用源码安装

学习了:http://blog.****.net/chosen0ne/article/details/7319807

git clone https://github.com/andymccurdy/redis-py.git

cd redis-py/

sudo python setup.py install

安装完毕

10,安装后测试

python

>>> import redis

>>>conn=redis.Redis()

>>>conn.set('hello','world')

True

>>>conn.get('hello')

'world'