Python_pip install pymysql error: OSError: mysql_config not found

 

Due to project needs, I need to install pymysql using the Django framework,

Using pip installation error is as follows:

 

(venv) [root@dev-109-kvm superset_dev]# pip install pymysql 
Collecting pymysql
  Using cached https://files.pythonhosted.org/packages/ed/39/15045ae46f2a123019aa968dfcba0396c161c20f855f11dea6796bcaae95/PyMySQL-0.9.3-py2.py3-none-any.whl
Collecting mysqlclient
  Downloading https://files.pythonhosted.org/packages/f4/f1/3bb6f64ca7a429729413e6556b7ba5976df06019a5245a43d36032f1061e/mysqlclient-1.4.2.post1.tar.gz (85kB)
     |████████████████████████████████| 92kB 448kB/s 
    ERROR: Complete output from command python setup.py egg_info:
    ERROR: /bin/sh: mysql_config: command not found
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-evbwpngw/mysqlclient/setup.py", line 16, in <module>
        metadata, options = get_config()
      File "/tmp/pip-install-evbwpngw/mysqlclient/setup_posix.py", line 51, in get_config
        libs = mysql_config("libs")
      File "/tmp/pip-install-evbwpngw/mysqlclient/setup_posix.py", line 29, in mysql_config
        raise EnvironmentError("%s not found" % (_mysql_config_path,))
    OSError: mysql_config not found
    ----------------------------------------
ERROR: Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-evbwpngw/mysqlclient/

 

solution:

yum install mysql-server mysql-client mysql-devel

The development kit corresponding to mysql needs to be installed, but since my Centos version is Centos7, MySQL cannot be found from official sources by default.

So we need to install Mysql related packages in the following form:

Please refer to my other article:

https://blog.csdn.net/u010003835/article/details/97963117

 

 

 

Published 519 original articles · praised 1146 · 2.83 million views

Guess you like

Origin blog.csdn.net/u010003835/article/details/97965321