当我试图在一个虚拟环境(pip install MySQL-python)中安装MySQL-python时,我得到了以下错误(截断到最后几行)
_mysql.c: At top level:
_mysql.c:2551: error: ‘_mysql_ConnectionObject’ has no member named ‘open’
_mysql.c:2558: error: ‘_mysql_ConnectionObject’ has no member named ‘converter’
_mysql.c:2565: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c:2572: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c:2579: error: ‘_mysql_ConnectionObject’ has no member named ‘connection’
_mysql.c:2642: error: ‘_mysql_ResultObject’ has no member named ‘converter’
_mysql.c:2642: error: initializer element is not constant
_mysql.c:2642: error: (near initialization for ‘_mysql_ResultObject_memberlist[0].offset’)
_mysql.c: In function ‘_mysql_ConnectionObject_getattr’:
_mysql.c:2666: error: ‘_mysql_ConnectionObject’ has no member named ‘open’
error: command 'gcc' failed with exit status 1谷歌告诉我,我需要安装python-devel,尽管当我运行yum install python-devel时,我得到
Package python-devel-2.6.6-52.el6.x86_64 already installed and latest version
Nothing to do我使用的是一台安装了CentOS 2.6和2.7的Python6.5机器。我在我的virtualenv中使用了python 2.7。当我运行pip install mySQL-python时,我激活了virtualenv。
我尝试在virtualenv激活和停用的情况下运行yum install python-devel,两次都给出了“已安装”的消息。
这是否意味着Python27安装没有安装python-devel?
另一个线程建议尝试yum install mysql-devel.x86_64,尽管这给出了
Resolving Dependencies
--> Running transaction check
---> Package mysql-devel.x86_64 0:5.1.73-3.el6_5 will be installed
--> Processing Dependency: mysql = 5.1.73-3.el6_5 for package: mysql-devel-5.1.73-3.el6_5.x86_64
--> Finished Dependency Resolution
Error: Package: mysql-devel-5.1.73-3.el6_5.x86_64 (base)
Requires: mysql = 5.1.73-3.el6_5
Installed: mysql-5.5.40-1.el6.remi.x86_64 (@remi)
mysql = 5.5.40-1.el6.remi
Available: mysql-5.1.73-3.el6_5.x86_64 (base)
mysql = 5.1.73-3.el6_5
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest(使用--skip-broken不起作用,它只是跳过它)
发布于 2014-11-16 14:25:41
解决方案:我需要运行sudo yum --enablerepo=remi install mysql-devel
然后,运行pip install MySQL-python (激活了我的virtualenv )
请参阅此答案https://serverfault.com/questions/601162/cant-install-mysql-devel-on-centos-6-5
(我发誓我在发帖前搜索了大约1.5个小时)
https://stackoverflow.com/questions/26954417
复制相似问题