Mysqlclient Error: ERROR: No matching distribution found for mysqlclient/OSError: mysql_config not found

Error: no matching distribution found for mysqlclient solution

Red hat/CentOS system

sudo yum install python3-devel mysql-devel

Debian/Ubuntu system

 sudo apt-get install python3-dev default-libmysqlclient-dev build-essential

Install mysqlclient

pip isntall mysqlclient

OSError: mysql_config not found Solution

  ERROR: Command errored out with exit status 1:
   command: /usr/local/python3/bin/python3.9 -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ubc4i40h/mysqlclient_b88fc9c0c9484503a326b0399e91838e/setup.py'"'"'; __file__='"'"'/tmp/pip-install-ubc4i40h/mysqlclient_b88fc9c0c9484503a326b0399e91838e/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-me3mh3fr
       cwd: /tmp/pip-install-ubc4i40h/mysqlclient_b88fc9c0c9484503a326b0399e91838e/
  Complete output (10 lines):
  /bin/sh: mysql_config: command not found
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/tmp/pip-install-ubc4i40h/mysqlclient_b88fc9c0c9484503a326b0399e91838e/setup.py", line 17, in <module>
      metadata, options = get_config()
    File "/tmp/pip-install-ubc4i40h/mysqlclient_b88fc9c0c9484503a326b0399e91838e/setup_posix.py", line 47, in get_config
      libs = mysql_config("libs_r")
    File "/tmp/pip-install-ubc4i40h/mysqlclient_b88fc9c0c9484503a326b0399e91838e/setup_posix.py", line 29, in mysql_config
      raise EnvironmentError("%s not found" % (mysql_config.path,))
  OSError: mysql_config not found

Ubuntu system

sudo apt-get install libmysqlclient-dev

centOS7

yum install mysql-devel gcc gcc-devel python-deve

Read More: