2

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

如果从头开始最简单,你能建议一个 ami 和相关的命令来进行这个配置吗?

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

百胜安装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,但我觉得此时我正在玩猜谜游戏。谢谢你的帮助。

4

2 回答 2

3

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

于 2012-06-13T04:46:03.167 回答
0

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

换句话说,东西可能会坏掉。

于 2012-06-01T19:47:26.503 回答