码迷,mamicode.com
首页 > 数据库 > 详细

ubuntu安装mysql-python

时间:2014-11-10 13:50:09      阅读:241      评论:0      收藏:0      [点我收藏+]

标签:mysql_config   mysql-python   python-dev   libmysqld-dev   libmysqlclient-dev   


1.首先你要确定ubuntu更新源能用,下面的源适合13.X和14.X,低版本的ubuntu没试过。毕竟劳资不是测试人员。

  为了安全起见 cp /etc/apt/source.list /etc/apt/source.list.bak 

 将下面的内容写到/etc/apt/source.list

deb http://mirrors.163.com/ubuntu/ trusty main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ trusty-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ trusty-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ trusty-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ trusty main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ trusty-security main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ trusty-updates main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ trusty-backports main restricted universe multiverse

2. sudo apt-get update

3.sudo apt-get install mysql-python

   发现报错了:

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


4.具体原因是安装程序在/usr/bin/下找不到mysql_config文件。

在网上查的解决方法,一般是说你没有libmysqld-dev 或libmysqlclient-dev ,可是查了一下发现都存在。

bubuko.com,布布扣

首先一个重要的python-dev一般都没有安装,所以需要sudo apt-get install python-dev

完事继续安装mysql-python,发现还是不行。

重装libmysqlclient-dev,

奇迹终于出现了:

bubuko.com,布布扣

ubuntu安装mysql-python

标签:mysql_config   mysql-python   python-dev   libmysqld-dev   libmysqlclient-dev   

原文地址:http://blog.csdn.net/duomoke/article/details/40979433

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!