centos7 安装 IRedis 命令行工具
## 更新 Python 到 3.x
yum -y install gcc ## 更新 gcc
yum -y install openssl-devel ## 安装openssl
wget https://www.python.org/ftp/python/3.6.4/Python-3.6.4.tgz && tar -zxvf Python-3.6.4.tgz ## 下载 3.6.4 版本的 Python 并解压
cd Python-3.6.4/ ## 进入刚刚解压的文件夹
sh configure --with-ssl ## 执行配置脚本 使用ssl模式 前提是已经安装了 openssl-devel
make ## 安装 编译
make install ## 安装 编译
python -V ## 查看 Python 版本
python3 -V ## 查看 Python 版本
## 如果存在旧版本 则将软连接修改以下
mv /usr/bin/python /usr/bin/python.bak
ln -s /usr/local/bin/python3 /usr/bin/python
## 更新 pip (有可能导致在安装 iredis 时出现错误,百度一下更新 pip)
python -m pip install --upgrade pip
## 安装 Iredids
pip install iredis
错误
## 执行configure配置脚本时出现该错误,重新安装 gcc(yum -y install gcc)
configure: error: no acceptable C compiler found in $PATH
## 缺少zlib解压缩类库 安装一下即可 (yum -y install zlib*)
can't decompress data; zlib not available
## yum在Python3下无法运行 修改 yum 文件(vim /usr/bin/yum),将 #!/usr/bin/python换成 #!/usr/bin/python2
[root@localhost Python-3.6.4]# yum -V
File "/usr/bin/yum", line 30
except KeyboardInterrupt, e:
^
SyntaxError: invalid syntax