安装Python3
1)官网下载源码,如:Python-3.6.2.tgz
2)解压:tar -xzvf Python-3.6.2.tgz
3)进入解压后目录:cd Python-3.6.2
4)安装pip3依赖的模块:yum install -y openssl openssl-devel
5)在Python-3.6.2目录下执行配置检查:./configure
6)在Python-3.6.2目录下执行安装:make && make install
安装hiredis
hiredis是我学习《redis实战》时用到的redis的python客户端库。用的是python2.x版本。
在这里顺带记录一下:
1)安装依赖:yum install -y python-devel
2)安装python的redis客户端库hiredis:pip install redis hiredis
(hiredis模块包装了redis模块,因此hiredis依赖redis)
python3同样可以用以上方法安装
验证
[root@beta-cat Python-3.6.2]# python Python 2.7.5 (default,Nov 6 2016,00:28:07) [GCC 4.8.5 20150623 (Red Hat 4.8.5-11)] 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/centos/376027.html