在Linux AMI上安装MySQLdb Python模块的问题

时间:2012-05-31 16:03:10

标签: python mysql-python ami

我正在尝试使用mysql(5.1或更高版本),python(2.6或更高版本)和mysqldb python模块在ec2中设置linux ami。有两个选项,从头开始或解决我已经开始的问题。

如果从头开始最简单的话,你能否建议使用ami和相关命令来进行此配置?

这是我尝试过的。我从这个ami开始:LAMP_Rails_Python_plus_goodies(ami-5db76434)。这给了我mysql和python。我有mysqldb模块,但我相信它需要python-devel包。我尝试使用以下内容安装它:

yum install python-devel

结果是:

Transaction Check Error:
  file /etc/rpm/macros.python from install of python-1:2.6-2.22.amzn1.noarch conflicts with file from package system-release-2011.09-2.3.noarch

这就是我被卡住的地方。我不知道如何解决这场冲突。构建mysqldb模块(python setup.py build)会导致:

In file included from _mysql.c:29:
pymemcompat.h:10:20: error: Python.h: No such file or directory
_mysql.c:30:26: error: structmember.h: No such file or directory
_mysql.c:36:23: error: my_config.h: No such file or directory
_mysql.c:38:19: error: mysql.h: No such file or directory
_mysql.c:39:26: error: mysqld_error.h: No such file or directory
_mysql.c:40:20: error: errmsg.h: No such file or directory
_mysql.c:62: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token

谷歌搜索让我相信我需要安装python-devel。也许我应该使用不同的ami,但我觉得我现在正在玩一个猜谜游戏。谢谢你的帮助。

2 个答案:

答案 0 :(得分:3)

在运行yum update -y之前运行yum install python-devel,它应该正确安装(没有事务检查错误)。

答案 1 :(得分:0)

您可以通过下载RPM并使用rpm -ivH --replacefiles .rpm安装它来安装它。但是,这意味着您的python rpm实际上并不是为您的发行版制作的(或者测试不是很好)。

换句话说,STUFF可能会破裂。

相关问题