Ubuntu中安装mysql-python失败的解决方法

前端之家收集整理的这篇文章主要介绍了Ubuntu中安装mysql-python失败的解决方法前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

1.首先你要确定Ubuntu更新源能用,本文测试的Ubuntu 14.04的源,低版本的Ubuntu没试过。毕竟劳资不是测试人员。

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

下面的是Ubuntu 14.04的源,(其他版本的源请自己查找)将下面的内容写到/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 ,可是查了一下发现都存在。

Ubuntu安装<a href=MysqL-python" src="http://img.jb51.cc/vcimg/static/loading.png" vspace="5" src="http://www.linuxidc.com/upload/2014_11/14111019448645.png">

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

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

6.重装libMysqLclient-dev,

奇迹终于出现了:

Ubuntu安装<a href=MysqL-python" src="http://img.jb51.cc/vcimg/static/loading.png" vspace="5" src="http://www.linuxidc.com/upload/2014_11/14111019443970.png">

猜你在找的Ubuntu相关文章