1. 程式人生 > >mysql-python安裝時EnvironmentError: mysql_config not found

mysql-python安裝時EnvironmentError: mysql_config not found

在安裝 mysql-python時,會出現:

sh: mysql_config: not found
Traceback (most recent call last):
  File "setup.py", line 15, in <module>
    metadata, options = get_config()
  File "/home/zhxia/apps/source/MySQL-python-1.2.3/setup_posix.py", line 43, in get_config
    libs = mysql_config("libs_r")
  File "/home/zhxia/apps/source/MySQL-python-1.2.3/setup_posix.py", line 24, in mysql_config
    raise EnvironmentError("%s not found" % (mysql_config.path,))
EnvironmentError: mysql_config not found

只要原因是沒有安裝:libmysqlclient-dev

對於CentOS:

yum install mysql-devel

對於openSUSE:

zypper install libmysqlclient-devel

對於基於Debian的系統/ Ubuntu:

apt-get install libmysqlclient-dev

或者,您可以使用aptitude基於Debian的系統。