1

In CentOS7.2, I install the mysql client by pip3, but get bellow error:

[root@controller src]# pip3 install mysqlclient
Collecting mysqlclient
  Using cached mysqlclient-1.3.12.tar.gz
    Complete output from command python setup.py egg_info:
    /bin/sh: mysql_config: did not find the command
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-1qgj63ha/mysqlclient/setup.py", line 17, in <module>
        metadata, options = get_config()
      File "/tmp/pip-build-1qgj63ha/mysqlclient/setup_posix.py", line 44, in get_config
        libs = mysql_config("libs_r")
      File "/tmp/pip-build-1qgj63ha/mysqlclient/setup_posix.py", line 26, in mysql_config
        raise EnvironmentError("%s not found" % (mysql_config.path,))
    OSError: mysql_config not found

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-1qgj63ha/mysqlclient/

As we all know the mysqlclient for Python3 is the replacement of MySQL-python for Python2. But why in CentOS7.2 I can not install it?

aircraft
  • 25,146
  • 28
  • 91
  • 166
  • Possible duplicate of [pip install mysql-python fails with EnvironmentError: mysql\_config not found](https://stackoverflow.com/questions/5178292/pip-install-mysql-python-fails-with-environmenterror-mysql-config-not-found) – hoefling Dec 10 '17 at 00:50

1 Answers1

0

Finally, I find I should install the mysql and configure it first, if do not install it will have OSError: mysql_config not found this error.

yum install python-devel mysql-community-devel -y
aircraft
  • 25,146
  • 28
  • 91
  • 166