簡體   English   中英

無法在virtualenv中安裝mySQL-python

[英]cannot install mySQL-python in virtualenv

當我嘗試在virtualenv中pip install MySQL-pythonpip 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

Googling告訴我我需要安裝python-devel ,但是當我運行yum install python-devel時,我會yum install python-devel

Package python-devel-2.6.6-52.el6.x86_64 already installed and latest version
Nothing to do

我在同時安裝了python 2.6和2.7的CentOS 6.5機器上。 我在virtualenvs中使用python 2.7。 我在運行pip install mySQL-python時激活了virtualenv。

我嘗試在激活和禁用virtualenv的情況下運行yum install python-devel ,它兩次都給出“已安裝”消息。

這是否意味着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小時)

暫無
暫無

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

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