【问题标题】:MySQLdb module installation problem for pythonpython的mysqldb模块安装问题
【发布时间】:2011-06-13 13:53:45
【问题描述】:

我使用 yum 在 centos VPS 中安装了 MySQLdb 模块,它说安装成功,没有错误。但是当我浏览 python 站点时,它会显示错误。 “加载 MySQLdb 模块时出错:没有名为 MySQLdb 的模块”。可以在http://74.53.127.172/ 看到错误的详细信息。我也尝试从压缩文件中安装这个模块,但它会产生以下错误:

_mysql.c: In function â_mysql_ConnectionObject_get_proto_infoâ:
_mysql.c:1633: error: â_mysql_ConnectionObjectâ has no member named âope        nâ
_mysql.c:1634: warning: implicit declaration of function âmysql_get_prot        o_infoâ
_mysql.c:1634: error: â_mysql_ConnectionObjectâ has no member named âcon        nectionâ
_mysql.c: In function â_mysql_ConnectionObject_get_server_infoâ:
_mysql.c:1648: error: â_mysql_ConnectionObjectâ has no member named âope        nâ
_mysql.c:1649: warning: implicit declaration of function âmysql_get_serv        er_infoâ
_mysql.c:1649: error: â_mysql_ConnectionObjectâ has no member named âcon        nectionâ
_mysql.c:1649: warning: passing argument 1 of âPyString_FromStringâ make        s pointer from integer without a cast
_mysql.c: In function â_mysql_ConnectionObject_infoâ:
_mysql.c:1665: error: â_mysql_ConnectionObjectâ has no member named âope        nâ
_mysql.c:1666: warning: implicit declaration of function âmysql_infoâ
_mysql.c:1666: error: â_mysql_ConnectionObjectâ has no member named âcon        nectionâ

【问题讨论】:

    标签: python django yum


    【解决方案1】:

    使用以下命令安装在centos中顺利运行mysql所需的其他包

    >> yum install python-devel
    >> yum install MySQL-devel
    >> yum install zlib-devel
    >> yum install openssl-devel
    

    愉快的编码:)

    【讨论】:

      【解决方案2】:

      尝试生成一个 python 交互式 shell,然后导入 MySQLdb,看看你是否得到同样的错误,在这种情况下,模块没有成功安装。 尝试“定位 mysqldb”并给我们输出。

      【讨论】:

        猜你喜欢
        • 2012-06-05
        • 1970-01-01
        • 1970-01-01
        • 2015-07-28
        • 1970-01-01
        • 2017-07-07
        • 2011-03-20
        • 1970-01-01
        • 2022-01-04
        相关资源
        最近更新 更多