python的MySQLdb模块安装问题

发布于 2024-11-15 16:42:46 字数 1322 浏览 7 评论 0原文

我使用 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â

I installed MySQLdb module in centos VPS using yum and it says successfully installed producing no error. but when I browse the python site it displays the error. "Error loading MySQLdb module: No module named MySQLdb". Details of the error can be seen at http://74.53.127.172/. I also tried to install this module from the zipped file but it produces following error:

_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â

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

聊慰 2024-11-22 16:42:46

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

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

快乐编码:)

use the following command to install other packages required to run mysql in centos smoothly

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

Happy coading :)

断肠人 2024-11-22 16:42:46

尝试生成一个 python 交互式 shell,然后导入 MySQLdb 并查看是否出现相同的错误,在这种情况下,模块未成功安装。
尝试“locate mysqldb”并给我们输出。

Try spawning a python interactive shell then import MySQLdb and see if you get the same error, in which case the module was not successfully installed.
Try "locate mysqldb" and give us the output .

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文