Python_pip 安装 pymysql 报错 : OSError: mysql_config not found

 

由于项目需要 ,我使用 Django框架需要安装 pymysql ,

使用 pip 安装报错如下:

 

(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 "", line 1, in 
      File "/tmp/pip-install-evbwpngw/mysqlclient/setup.py", line 16, in 
        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/

 

解决方案:

yum install mysql-server mysql-client mysql-devel

需要安装 mysql 对应的开发套件 ,但是由于我的Centos 版本是 Centos7 默认是无法从官方源找到 MySQL 的,

所以我们需要通过如下形式安装 Mysql 相关包:

请参考我的另一篇文章 :

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

 

 

 

你可能感兴趣的:(Python语言,Python_Django,pymsql,OSError:,mysql_config,not,foun)