系统:Centos7

版本:Python2.7

先配置Percona

wget https://www.percona.com/redir/downloads/percona-release/redhat/latest/percona-release-0.1-4.noarch.rpm
rpm -ivh percona-release-0.1-4.noarch.rpm
yum install Percona-Server-server-56.x86_64

配置pip

yum install python-pip -y

更新pip

pip install --upgrade pip

安装MySQLdb模块

pip install mysql-python

报错:Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-JRdBT6/mysql-python/

解决:

yum install mysql-devel python-devel -y

然后再使用

pip install mysql-python

Collecting mysql-python

  Using cached MySQL-python-1.2.5.zip

Installing collected packages: mysql-python

  Running setup.py install for mysql-python ... done

Successfully installed mysql-python-1.2.5

安装成功。

无觅关联推荐,快速提升流量