1. 程式人生 > >debian 下py2.7 安裝mysql模組

debian 下py2.7 安裝mysql模組

先安裝pip

然後用pip安裝 setuptools

安裝模組的時候會報錯 

 

python setup.py install
sh: mysql_config: command not found
Traceback (most recent call last):
  File "setup.py", line 15, in <module>
    metadata, options = get_config()
  File "/usr/lib/python2.5/MySQL-python-1.2.3/setup_posix.py", line 43, in get_config
    libs = mysql_config("libs_r")
  File "/usr/lib/python2.5/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

找不到
mysql_config
網上找了很多辦法,在一個外國的帖子裡說是mysql少裝了一個東西

mysql-config is in a different package, which can be installed from (again, assuming debian / ubuntu):

sudo apt-get install libmysqlclient-dev

if you are using mariadb, the drop in replacement for mysql, then run

sudo apt-get install libmariadbclient-dev


反正我用這個辦法解決了