linux下python安装Mysql扩展

安装MySQL-Python-1.2.3c1出现“error: command 'gcc' failed with exit status 1”错误
具体报错信息如下:

_mysql.c: 在文件层:
_mysql.c:2330: 错误:‘_mysql_ConnectionObject’没有名为‘open’的成员
_mysql.c:2337: 错误:‘_mysql_ConnectionObject’没有名为‘converter’的成员
_mysql.c:2344: 错误:‘_mysql_ConnectionObject’没有名为‘connection’的成员
_mysql.c:2351: 错误:‘_mysql_ConnectionObject’没有名为‘connection’的成员
_mysql.c:2358: 错误:‘_mysql_ConnectionObject’没有名为‘connection’的成员
_mysql.c:2421: 错误:‘_mysql_ResultObject’没有名为‘converter’的成员
_mysql.c:2421: 错误:初始值设定元素不是常量
_mysql.c:2421: 错误:(在‘_mysql_ResultObject_memberlist[0].offset’的初始化附近)
_mysql.c: 在函数‘_mysql_ConnectionObject_getattr’中:
_mysql.c:2443: 错误:‘_mysql_ConnectionObject’没有名为‘open’的成员
error: command 'gcc' failed with exit status 1

环境为:
系统版本:ORALCE_RHEL6
Python版本:2.7.8

Mysql-python的site.cfg文件内容如下:

[root@oracle MySQL-python-1.2.3c1]# cat site.cfg 
[options]
# embedded: link against the embedded server library
# threadsafe: use the threadsafe client
# static: link against a static library (probably required for embedded)

embedded = False
threadsafe = False 
static = False

# The path to mysql_config.
# Only use this if mysql_config is not on your PATH, or you have some weird
# setup that requires it.
mysql_config =/usr/bin/mysql_config

# The Windows registry key for MySQL.
# This has to be set for Windows builds to work.
# Only change this if you have a different version.
registry_key = SOFTWARE\MySQL AB\MySQL Server 5.0

已经安装:

[root@oracle Packages]# rpm -ivh python-devel-2.6.6-51.el6.i686.rpm 
Preparing...                ########################################### [100%]
   1:python-devel           ########################################### [100%]
[root@oracle Packages]# rpm -ivh MySQL-python-1.2.3-0.3.c1.1.el6.i686.rpm 
Preparing...                ########################################### [100%]
   1:MySQL-python           ########################################### [100%]

还是存在error: command 'gcc' failed with exit status 1

现在应该如何解决呢?

——————
最后还是被我自己解决了,在windows下已经安装过MySQLdb了,但是在Linux下安装不成功,很懊恼。
现在写下解决方法(还是走了很多弯路,好年轻啊!!!):
安装所有的依赖:

yum install python-devel mysql-devel zlib-devel openssl-devel

下载MySQL-python-1.2.3.tar.gz
windows版本MySQL-python-1.2.3.win32-py2.7
解压,并安装即可。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值