命令" python setup.py egg_info" / tmp / pip-build-hg0dbjgz / mysqlclient /中的错误代码1失败

时间:2017-12-11 06:23:52

标签: python mysql

我无法使用pip:

在CentOS7.2中安装mysqlclient
$ pip 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 found the command
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-hg0dbjgz/mysqlclient/setup.py", line 17, in <module>
        metadata, options = get_config()
      File "/tmp/pip-build-hg0dbjgz/mysqlclient/setup_posix.py", line 44, in get_config
        libs = mysql_config("libs_r")
      File "/tmp/pip-build-hg0dbjgz/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-hg0dbjgz/mysqlclient/

我已经在我的服务器中正确安装了MySQL。

$ mysql --version
mysql  Ver 14.14 Distrib 5.6.38, for Linux (x86_64) using  EditLine wrapper

但我无法安装

1 个答案:

答案 0 :(得分:1)

您应安装python-develmysql devel首次使用yum:

yum install python-devel mysql-community-devel -y

然后您可以安装mysqlclient