本文讲述了python安装mysql-python的方法。分享给大家供大家参考,具体如下:

ubuntu 系统下进行的操作

首先安装了pip工具

1
sudo apt-get install python-pip

然后使用

1
sudo pip install mysql-python

安装第三方库.但是此时报错

1
2
3
4
5
6
7
8
9
sh: mysql_config: not found
Traceback (most recent call last):
 File "setup.py", line 15, in <module>
  metadata, options = get_config()
 File "/home/zhxia/apps/source/MySQL-python-1.2.3/setup_posix.py", line 43, in get_config
  libs = mysql_config("libs_r")
 File "/home/zhxia/apps/source/MySQL-python-1.2.3/setup_posix.py", line 24, in mysql_config
  raise EnvironmentError("%s not found" % (mysql_config.path,))
EnvironmentError: mysql_config not found

原因是没有安装:libmysqlclient-dev

1
sudo apt-get install libmysqlclient-dev

继续安装 发现 还是报错

mysql.c:29:20: fatal error: Python.h: 没有那个文件或目录,找不到Python头文件,难道wheezy默认没有安装python开发包?

1
sudo dpkg -l | grep python-dev

果然没有,还真的需要安装:

1
sudo apt-get install python-dev

MySQL-python就可以编译通过了。

ubuntu安装python MySQLdb模块的更多相关文章

  1. ubuntu 安装python mysqldb

    sudo apt-get install python-mysqldb #!/usr/bin/python #-*-coding:utf-8-*- ''' This file include all ...

  2. Windows 安装 python MySQLdb模块

    pip install wheel 去这个网站查找whl格式的MYSQL-python http://www.lfd.uci.edu/~gohlke/pythonlibs/#mysql-python ...

  3. ubuntu 安装python mysql模块

    Installation Starting with a vanilla Lucid install , install pip and upgrade to the latest version: ...

  4. Python MySQLdb模块连接操作mysql数据库实例_python

    mysql是一个优秀的开源数据库,它现在的应用非常的广泛,因此很有必要简单的介绍一下用python操作mysql数据库的方法.python操作数据库需要安装一个第三方的模块,在http://mysql ...

  5. cygwin 下安装python MySQLdb

    cygwin 下安装python MySQLdb 1) cygwin 更新 运行 cygwin/setup-x86_64.exe a 输入mysql,选择下面的包安装: libmysqlclient- ...

  6. centos7 安装 Python netsnmp模块

    由于模块的安装过程中有点艰难(其实挺简单,只是参照网上的教程很多都装不成功,花了很多时间...),所以记下来备忘. 先装一下python-devel 模块,执行命令 yum install pytho ...

  7. macOS安装Python MySQLdb

    macOS安装Python MySQLdb 0. 参考 Mac OS X - EnvironmentError: mysql_config not found 1. 背景 import MySQLdb ...

  8. ubuntu 安装python,easy_install和pip

    ubuntu12.04默认安装的python为 ms@ubuntums:~$ pythonPython 2.7.3 (default, Aug 1 2012, 05:16:07) 我需要用python ...

  9. 安装ubuntu系统及ubuntu安装Python的几点心得

    一.安装ubuntu系统 1.ubuntu系统是Linux系统的一种,和centos差别不大,但是个人还是建议大家安装ubuntu,它更适合国内使用习惯,换句话说更亲切. 2.安装方法不再赘述,网上有 ...

随机推荐

  1. 在ubuntu上部署Kubernetes管理docker集群示例, vxlan,gre

    http://www.chenshake.com/openstack-folsom-guide-for-ubuntu-12-04/ http://www.cnblogs.com/sammyliu/p/ ...

  2. 前端开发 - JavaScript - 上

    1.js引入 <!DOCTYPE html> <html lang="cn"> <head> <meta charset="UT ...

  3. Django 框架之视图函数(Views)

    http请求中产生的两个核心对象: http请求: HttpRequest对象 http响应: HttpResponse对象 所在位置: django.http HttpRequest 对象的属性和方 ...

  4. MyBatis 工作流程及插件开发

    1. MyBatis 框架分层架构 2. MyBatis 工作流程 获取 SqlSessionFactory 对象: 解析配置文件(全局映射,Sql映射文件)的每一个信息,并保存在Configurat ...

  5. golang http.ResponseWriter valid json

      golang httpserver如果采用 fmt.Fprintf(w, result)来输出json数据时,若json数据包含%号,则会出现问题.   输出结果里面会包含(MISSING)字样, ...

  6. Python高级特性(2):Closures、Decorators和functools(转)

    原文:Python高级特性(2):Closures.Decorators和functools 装饰器(Decorators) 装饰器是这样一种设计模式:如果一个类希望添加其他类的一些功能,而不希望通过 ...

  7. 需求-shidebing

    # 原始数据 list1 = [ {"c_id": "101", "e_code": "201"}, {"c_ ...

  8. DjangoORM 执行 python manage.py makemigrations出现 no changes detected

    出现 no changes detected python manage.py makemigrations No changes detected 为什么出现这种情况: 当执行这条命令,他会去找所有 ...

  9. #运算符、不同的指针类型、数组和指针、指针运算、堆、栈、静态区、只读区、下标VS指针

    #运算符:用于在预编译期将宏参数转换为字符串 #define CONVERS(x)  #x   //注:没用双引号包括. 不同类型的指针占用的内存空间大小相同. 局部变量 定义: a[5]; 打印a[ ...

  10. python16_day19【Django_抽屉项目】

    补充ORM块: 1.select_related()  # 解决:当有外健,规避多决查询,使用了join. 多次查询变成一次查询 例:UserInfo.objects.all().select_rel ...