1.安装构建工具
sudo apt-get -yqq update sudo apt-get -yqq install make gcc python-dev2.下载最新的stable版本Redis源码
3.解压源码,编译、安装并启动redis
tar -zxvf redis-3.2.5.tar.gz cd redis-3.2.5 make && make install redis-server ./redis.conf启动redis时的目录会默认作为持久化文件的保存位置
4.下载并安装Python语言的redis客户端库
下载安装setuptools
https://pypi.python.org/pypi/setuptools/#downloads
tar -zxvf setuptools-28.8.0.tar.gz cd setuptools-28.8.0 python setup.py install安装redis包和hiredis包
sudo python -m easy_install redis hiredis测试:
root@ubuntu:/python# python Python 2.7.12 (default,Nov 19 2016,06:48:10) [GCC 5.4.0 20160609] on linux2 Type "help","copyright","credits" or "license" for more information. >>> import redis >>> conn =redis.Redis() >>> conn.set('hello','world') True >>> conn.get('hello') 'world' >>>原文链接:https://www.f2er.com/ubuntu/355824.html