linux下MySQL-Python安装

前段时间配置MySQL-Python,遇到各种问题


现在把综合的解法集成如下(感谢广大的分享者们):

服务器环境允许yum


yum install MySQL-python -y

编译安装:

先下载源码包:

  $ tar xfz MySQL-python-1.2.1.tar.gz 
  $ cd MySQL-python-1.2.1 
  $ # edit site.cfg if necessary 
  $ python setup.py build 
  $ sudo python setup.py install # or su first

Ubuntu当编译安装MySQL-Python包有错误时

ImportError: No module named setuptools

EnvironmentError: mysql_config not found

In file included from _mysql.c:29:0: 
pymemcompat.h:10:20: fatal error: Python.h: No such file or directory


,可能是一些依赖的包没装:

如下:

安装步骤:

1、sudo apt-get install python-setuptools

2、sudo apt-get install libmysqld-dev

3、sudo apt-get install libmysqlclient-dev

4、sudo apt-get install python-dev

5、sudo easy_install mysql-python


你可能感兴趣的:(mysql,python)