Python: MySQLdb安装问题

2 投票
1 回答
871 浏览
提问于 2025-04-16 13:19

Mysql版本是5.0.77
Python版本是2.5

#easy_install MySQL-python

当我尝试安装的时候,出现了以下错误:

_mysql.c:2331: error: â_mysql_ConnectionObjectâ has no member named âopenâ
_mysql.c:2338: error: â_mysql_ConnectionObjectâ has no member named âconverterâ
_mysql.c:2345: error: â_mysql_ConnectionObjectâ has no member named âconnectionâ
_mysql.c:2352: error: â_mysql_ConnectionObjectâ has no member named âconnectionâ
_mysql.c:2359: error: â_mysql_ConnectionObjectâ has no member named âconnectionâ
_mysql.c:2422: error: â_mysql_ResultObjectâ has no member named âconverterâ
_mysql.c:2422: error: initializer element is not constant
_mysql.c:2422: error: (near initialization for â_mysql_ResultObject_memberlist[0].offsetâ)
_mysql.c:2444: error: â_mysql_ConnectionObjectâ has no member named âopenâ
error: Setup script exited with error: command 'gcc' failed with exit status 1

我该如何解决这个问题呢?

1 个回答

6

首先,你需要在你的系统上安装一个叫做mysql-devel的东西。你可以通过输入这个命令来安装:yum install mysql-devel

接下来,你要安装一个叫做MySQL-python的库,这样你就可以在你的程序里使用MySQL了。你可以用这个命令来安装:easy_install MySQL-python

撰写回答