centos 7 安装mysql-python

1.首先要先下载,MySQLdb下载地址:

https://pypi.python.org/pypi/MySQL-python/1.2.5


2. unzip MySQL-python-1.2.5;


3. cd MySQL-python-1.2.5;

  python setup.py install;

此时报错:

Traceback (most recent call last):
  File "setup.py", line 17, in <module>
    metadata, options = get_config()
  File "/root/MySQL-python-1.2.5/setup_posix.py", line 43, in get_config
    libs = mysql_config("libs_r")
  File "/root/MySQL-python-1.2.5/setup_posix.py", line 25, in mysql_config
    raise EnvironmentError("%s not found" % (mysql_config.path,))
EnvironmentError: mysql_config not found

原因是没有安装mysql-devel;

yum install mysql-devel;


4.重新运行python setup.py install



你可能感兴趣的:(centos 7 安装mysql-python)