zoukankan      html  css  js  c++  java
  • centos下装不上mysqlclient

    如果是报OSError: mysql_config not found,则先使用yum list installed | grep xx检查如下包的安装情况。

    yum list installed | grep gcc
    yum list installed | grep mysql
    yum list installed | grep mariadb
    yum list installed | grep python
    • 1
    • 2
    • 3
    • 4

    支持mysql_config是需要安装下面的软件的:

    gcc
    gcc-c++
    python3-devel  (注意如果是python3安装的是python3-devel)
    mariadb-devel   (centos7中叫把mysql-devle叫mariadb-devel)
    libffi-devel
    openssl-devel
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6

    即使用下面的安装语句即可

    yum install gcc gcc-c++ python3-devel mariadb-devel libffi-devel openssl-devel
    • 1

    如果mariadb-devel安装不成功,或者还是报mysql_config not found错,则可以先通过yum list installed | grep mariadb查看所有的mariadb包,然后使用yum remove xxx把相关的包都删除,再安装mariadb-devel

    yum install mariadb-devel
    • 1

    如果是报或者Python.h no found错误,则检查是不是只安装了python-devel而没有安装python3-devel

    如果此时还抛出gcc error,例如

        MySQLdb/_mysql.c:1340:5: error: ‘for’ loop initial declarations are only allowed in C99 mode
             for (unsigned int i=0; i<n; i++) {
             ^
        MySQLdb/_mysql.c:1340:5: note: use option -std=c99 or -std=gnu99 to compile your code
        error: command 'gcc' failed with exit status 1
    • 1
    • 2
    • 3
    • 4
    • 5

    上述错误是由于mysqlclient的源码编译错误,可以尝试降低mysqlclient的版本,即可安装成功。
    例如:

    pip3 install mysqlclient==2.0.3
    • 1
    每天逼着自己写点东西,终有一天会为自己的变化感动的。这是一个潜移默化的过程,每天坚持编编故事,自己不知不觉就会拥有故事人物的特质的。 Explicit is better than implicit.(清楚优于含糊)
  • 相关阅读:
    android81 多线程下载和断电续传
    android80 HttpClient框架提交数据 get方式
    CentOS 7最小化安装后找不到‘ifconfig’命令——修复小提示
    Eclipse4.5在线安装Aptana插件及配置代码提示教程
    centos7 yum源
    ESXi License过期解决办法
    mysql grant 用户权限总结
    Unable to locate package错误解决办法
    华为USG6350防洪墙SNMP最简单功能配置
    ssl_error_weak_server_ephemeral_dh_key
  • 原文地址:https://www.cnblogs.com/kylin5201314/p/14876187.html
Copyright © 2011-2022 走看看