问题

Collecting MySQL-python==1.2.5 (from -r requirements.txt (line 3)) Downloading https://files.pythonhosted.org/packages/a5/e9/51b544da85a36a68debe7a7091f068d802fc515a3a202652828c73453cad/MySQL-python-1.2.5.zip (108kB)

  1. |████████████████████████████████| 112kB 462kB/s

ERROR: Complete output from command python setup.py egg_info:

ERROR: sh: mysql_config: command not found

Traceback (most recent call last):

  1. File "<string>", line 1, in <module>
  2. File "/tmp/pip-install-pKINs7/MySQL-python/setup.py", line 17, in <module>
  3. metadata, options = get_config()
  4. File "setup_posix.py", line 43, in get_config
  5. libs = mysql_config("libs_r")
  6. File "setup_posix.py", line 25, in mysql_config
  7. raise EnvironmentError("%s not found" % (mysql_config.path,))

EnvironmentError: mysql_config not found


ERROR: Command “python setup.py egg_info” failed with error code 1 in /tmp/pip-install-pKINs7/MySQL-python/

https://stackoverflow.com/questions/5178292/pip-install-mysql-python-fails-with-environmenterror-mysql-config-not-found

对于Ubuntu:

  1. $ sudo apt update
  2. $ sudo apt install python-dev
  3. $ sudo apt install python-MySQLdb

对于CentOS:

  1. $ yum install python-devel mysql-devel