1. 程式人生 > 其它 >pip install MySQL-python報錯解決

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