一、目标环境
属性 | 属性值 |
---|---|
系统版本 | CentOS Linux release 7.8.2003 (Core) |
Python 版本 | Python 2.7.5 |
⚠️ 注意:Python 3.x 请使用 pymsql,mysql-python 只兼容 Python 2.x 。
二、安装步骤
2.1 安装 EPEL 仓库
默认的仓库中没有收录 python-pip 包,需要执行下述命令安装 EPEL 仓库。
yum -y install epel-release
2.2 安装 python-pip
pip 是 Python 的包管理工具,执行下述命令安装。
yum -y install python-pip
2.3 安装 python-dev
CentOS 7 自带的 Python 是正式版本,缺少 mysql-pyt