2017-10-17 09:54:41

linux安装MySQLDb报错mysql_config not found

linux下(我这里是linux mint 18.2)用以下命令安装MySQLDb

pip install 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

然后去网上搜了下,大多是下载源码然后更改其中的某个文件,然后编译,感觉这样太麻烦了。

其实是因为缺少一个mysql 客户端开发的包,安装它就好了:

sudo apt-get install libmysqlclient-dev

然后仍旧用pip install MySQL-python安装即可。

Permanent link of this article:http://nulls.cc/post/install_mysqldb_under_linux

-- EOF --