mysql-python安装时Environment Error: mysql_config not found

在安装 mysql-python时,出现:

Collecting MySQL-python
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/a5/e9/51b544da85a36a68debe7a7091f068d802fc515a3a202652828c73453cad/MySQL-python-1.2.5.zip (108kB)
    100% |████████████████████████████████| 112kB 2.1MB/s
    Complete output from command python setup.py egg_info:
    sh: 1: mysql_config: not found
    Traceback (most recent call last):
      File "", line 1, in 
      File "/tmp/pip-install-vkUfD6/MySQL-python/setup.py", line 17, in 
        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

可能是因为没有安装:libmysqlclient-dev

执行以下命令安装:

sudo apt-get install python-dev libmysqlclient-dev

安装后再次执行安装 mysql-python命令:

pip install MySQL-python

成功安装:

参考来源:mysql-python安装时EnvironmentError: mysql_config not found

你可能感兴趣的:(mysql-python安装时Environment Error: mysql_config not found)