gpt4 book ai didi

python - 无法在 virtualenv 中安装 mySQL-python

转载 作者:行者123 更新时间:2023-11-28 21:18:18 25 4
gpt4 key购买 nike

当我尝试在 virtualenv 中安装 MySQL-python (pip install 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 6.5 机器上安装了 python 2.6 和 2.7。我在我的 virtualenvs 中使用 python 2.7。我在运行 pip install mySQL-python 时激活了 virtualenv。

我已经尝试运行 yum install python-devel 激活和停用 virtualenv,它两次都显示“已安装”消息。

这是否意味着 python 27 安装没有安装 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 不起作用,它只是跳过它)

最佳答案

已解决:我需要运行 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 小时)

关于python - 无法在 virtualenv 中安装 mySQL-python,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26954417/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com