centOS安装mysqlclient失败(通过pip3)

时间:2018-01-26 08:26:28

标签: django python-3.x centos

我想在centOS服务器上运行Django2.0, 我安装了python3和pip3, django2.0也安装在virtualenv下, 但是当我尝试在virturlenv下安装mysqlclient时出现错误,错误信息如下:

Collecting mysqlclient
  Using cached mysqlclient-1.3.12.tar.gz
    Complete output from command python setup.py egg_info:
    /bin/sh: mysql_config: command not found
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-7hd8p93o/mysqlclient/setup.py", line 17, in <module>
        metadata, options = get_config()
      File "/tmp/pip-build-7hd8p93o/mysqlclient/setup_posix.py", line 44, in get_config
        libs = mysql_config("libs_r")
      File "/tmp/pip-build-7hd8p93o/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-7hd8p93o/mysqlclient/

请知道

2 个答案:

答案 0 :(得分:4)

我用以下方法解决了同样的问题:

sudo yum install python36u-devel mysql-devel

答案 1 :(得分:0)

我解决了同样的问题!

yum install -y python3-devel.x86_64