簡體   English   中英

python的MySQLdb模塊安裝問題

[英]MySQLdb module installation problem for python

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

使用以下命令安裝在centos中順利運行mysql所需的其他包

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

快樂的編碼:)

嘗試生成一個 python 交互式 shell 然后導入 MySQLdb 並查看是否收到相同的錯誤,在這種情況下模塊未成功安裝。 嘗試“定位 mysqldb”並給我們 output。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM