资源经验分享解决centos7 安装mysqlclient报错问题

解决centos7 安装mysqlclient报错问题

2019-12-20 | |  102 |   0

原标题:解决centos7 安装mysqlclient报错问题

原文来自:CSDN      原文链接:https://blog.csdn.net/qq_36853469/article/details/103474533


1.安装

pip3 install mysqlclient

报错:

ERROR: Command errored out with exit status 1:
     command: /data/env/pyweb/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-noasaa4g/mysqlclient/setup.py'"'"'; __file__='"'"'/tmp/pip-install-noasaa4g/mysqlclient/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-noasaa4g/mysqlclient/pip-egg-info
         cwd: /tmp/pip-install-noasaa4g/mysqlclient/
    Complete output (12 lines):
    /bin/sh: mysql_config: command not found
    /bin/sh: mariadb_config: command not found
    /bin/sh: mysql_config: command not found
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-noasaa4g/mysqlclient/setup.py", line 16, in <module>
        metadata, options = get_config()
      File "/tmp/pip-install-noasaa4g/mysqlclient/setup_posix.py", line 61, in get_config
        libs = mysql_config("libs")
      File "/tmp/pip-install-noasaa4g/mysqlclient/setup_posix.py", line 29, in mysql_config
        raise EnvironmentError("%s not found" % (_mysql_config_path,))
    OSError: mysql_config not found
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

 

 01.png

 

 2.分析与解决:

查看报错信息:

mysql_config not found

确定是mysql_config依赖包出现了问题,添加软链接

ln -s /usr/local/mysql/bin/mysql_config /usr/local/bin/mysql_config

发现还是不行,网上说需要先安装mysql-devel

yum install mysql-devel

 再安装mysqlclient

pip3 install mysqlclient

 03.png

解决

 

免责声明:本文来自互联网新闻客户端自媒体,不代表本网的观点和立场。

合作及投稿邮箱:E-mail:editor@tusaishared.com

上一篇:centos7环境部署Django项目

下一篇:sklearn数据集 及 fetch_20newsgroups() data_home参数设置问题

用户评价
全部评价

热门资源

  • Python 爬虫(二)...

    所谓爬虫就是模拟客户端发送网络请求,获取网络响...

  • TensorFlow从1到2...

    原文第四篇中,我们介绍了官方的入门案例MNIST,功...

  • TensorFlow从1到2...

    “回归”这个词,既是Regression算法的名称,也代表...

  • TensorFlow2.0(10...

    前面的博客中我们说过,在加载数据和预处理数据时...

  • 机器学习中的熵、...

    熵 (entropy) 这一词最初来源于热力学。1948年,克...