0

I'm working on a Mac running MacOS High Sierra 10.13.2 (17C88). While installing mysql in my virtualenv I've got the following error:

Collecting MySQL-python==1.2.5 (from -r qs4bmg/requirements/common.txt (line 4))
  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: command not found
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/dx/hgccddq94qs8ww9ly3ykr0y40000gn/T/pip-install-guSoBx/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

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/dx/hgccddq94qs8ww9ly3ykr0y40000gn/T/pip-install-guSoBx/MySQL-python/

I've tried many solutions (this one the most popular, but using apt not pip) but with no success. Could you please help me solve this error?

user123892
  • 1,243
  • 3
  • 21
  • 38

1 Answers1

0

Finally I found the solution.

  1. update xcode
  2. $sudo xcodebuild -license accept

  3. $brew uninstall mysql-connector-c

  4. $brew install mysql

  5. $pip install mysqlclient

user123892
  • 1,243
  • 3
  • 21
  • 38