zoukankan      html  css  js  c++  java
  • ubuntu安装MySQL-python出现EnvironmentError: mysql_config not found错误

    问题:

    安装MySQL-python包报错EnvironmentError: mysql_config not found问题要如何来解决呢?

    首先,错误提示是mysql_config找不到,

    解决办法:

    1、终端输入命令

    sudo apt-get install libmysqlclient-dev

    执行上面命令时,可能还会有遇到下面问题:

     如果安装顺利,请略过,直接看步骤2。如果遇到同样问题,可以去到“设置”中的“软件和更新“”中,点开“更新”,勾选“”重要安全更新”和“推荐更新”

    关闭上面窗口后,在终端运行下面命令就能解决:

    sudo apt-get update

    完成之后,再次执行命令:sudo apt-get install libmysqlclient-dev

    2、成功安装libmysqlclient-dev后,执行下面两条命令进行加载更新

    $ sudo updatedb
    $ locate mysql_config 

    3、试着运行下面命令来安装MySQL-python

    $ pip install MySQL-python

    这时候,应该就能成功安装MySQL-Python了。如果您也不幸遇到跟我一样遇到下面的问题,提示说:

    _mysql.c:29:20: fatal error: Python.h: 没有那个文件或目录
    #include "Python.h"
    ^
    compilation terminated.
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

    那么,请继续往下看。

    4、终端运行一下命令完美解决

    $ sudo apt-get install python-dev
    $ pip install MySQL-python 

    5、扩展:ubuntu18 、python2.7安装ujson问题:

    pip install git+git://github.com/esnme/ultrajson.git #下载ujson的2.0版本

    6、扩展: ubuntu18 、python2.7安装不上uwsgi 2.0问题:执行以下命令

    pip install https://projects.unbit.it/downloads/uwsgi-lts.tar.gz
    世间安得双全法,不负如来不负卿
  • 相关阅读:
    POJ ACM题分类
    HDU 4438 Hunters (概率 & 期望)
    HDU 1042 N!
    HDU 1073 Online Judge
    PKU 1006 Biorhythms (中国剩余定理 * *)
    HDU 1047 Integer Inquiry
    HDU 2710 Max Factorv (素数模板 & 多种解法)
    HDU A + B Problem II 1002
    第6期(江西省吉安市永丰县)县长手机信箱工作简报(自吹自擂政绩,自圆其说)
    Send mail from ASP.NET using your gmail account
  • 原文地址:https://www.cnblogs.com/shangguanruoling/p/12053166.html
Copyright © 2011-2022 走看看