pip install MySQL-python报错解决
python2环境使用pip安装MySQL-python==1.2.5报错解决
报错如下
# pip install MySQL-python==1.2.5
Collecting MySQL-python==1.2.5
Using cached https://files.pythonhosted.org/packages/a5/e9/51b544da85a36a68debe7a7091f068d802fc515a3a202652828c73453cad/MySQL-python-1.2.5.zip
Complete output from command python setup.py egg_info:
sh: mysql_config: 未找到命令
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-dQ8p_X/MySQL-python/setup.py", line 17, in <module>
metadata, options = get_config()
File "setup_posix.py", line 43, in get_config
libs = mysql_config("libs_r")
File "setup_posix.py", line 25, in mysql_config
raise EnvironmentError("%s not found" % (mysql_config.path,))
EnvironmentError: mysql_config not found
原因分析
猜测可能是由于是最小安装的centos7,缺少某些模块、包的支持
解决
yum install mysql-devel
pip install MySQL-python==1.2.5