项目中需要python-mysqldb包 结果多次安装并未能成功,包括pip install
最后通过官方https://www.python.org/下载安装包后手动安装
下载好后对其进行解压
然后执行 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 那么我们安装以下步骤去操作
1.
sudo apt-get install mysql-server
2.
sudo apt-get install libmysqlclient-dev
3.
sudo apt-get install libmariadbclient-dev
然后我们再次执行 python setup.py install 这个时候就可以安装完成 (安装命令请自行替换 mac:brew ,centos:yum)