【问题标题】:Problems installing MySQLdb Python module on linux AMI在 linux AMI 上安装 MySQLdb Python 模块时出现问题
【发布时间】:2012-06-05 22:08:07
【问题描述】:

我正在尝试使用 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 包。我尝试使用以下方式安装它:

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,但我觉得此时我正在玩猜谜游戏。感谢您的帮助。

【问题讨论】:

    标签: python mysql-python amazon-ami


    【解决方案1】:

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

    【讨论】:

      【解决方案2】:

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

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

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2016-11-05
        • 2020-10-14
        • 2020-08-08
        • 2017-12-19
        • 1970-01-01
        • 2011-08-16
        • 2017-07-07
        • 2012-08-01
        相关资源
        最近更新 更多