Python中MySQLdb模块安装问题
我在CentOS的VPS上用yum安装了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â
2 个回答
0
试着打开一个Python的交互式命令行,然后导入MySQLdb,看看是否会出现同样的错误。如果出现错误,那说明这个模块没有成功安装。你可以试试输入“locate mysqldb”,然后把结果发给我们。
3
使用下面的命令来安装在CentOS上顺利运行MySQL所需的其他软件包。
>> yum install python-devel
>> yum install MySQL-devel
>> yum install zlib-devel
>> yum install openssl-devel
祝你编程愉快 :)