在安裝MySQLdb模塊的時候,不管是pip仍是apt-get都出現以下的錯誤。python
root@vpser:~# cd MySQL-python-1.2.3 root@vpser:~/MySQL-python-1.2.3# python setup.py install sh: mysql_config: not found Traceback (most recent call last): File "setup.py", line 15, in <module> metadata, options = get_config() File "/root/MySQL-python-1.2.3/setup_posix.py", line 43, in get_config libs = mysql_config("libs_r") File "/root/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
這個是由於缺乏libmysqld_dev, libmysqlclient_dev 兩個開發包引發的。mysql
在安裝過程當中直接apt了這兩個包,同時修改源代碼目錄下的setup_posix.py文件,sql
將mysql_config.path 修改成mysql_config.path="/usr/bin/mysql_config"shell
再次pip安裝成功。code