Pip无法安装pylibmc

时间:2014-06-26 18:07:30

标签: python centos pip libmemcached

CentOS 6.5版(最终版)。

Python 2.7.5使用Virtualenv。

> rpm -qa '*memcache*'
libmemcached-devel-0.31-1.1.el6.x86_64
libmemcached-0.31-1.1.el6.x86_64
libmemcache-devel-1.4.0-0.1.rc2.el6.rf.x86_64
libmemcache-1.4.0-0.1.rc2.el6.rf.x86_64

@ development-tools安装。

这是尝试安装pylibmc的输出:

> pip install pylibmc
Downloading/unpacking pylibmc
  Running setup.py egg_info for package pylibmc

    warning: no files found matching 'LICENSE'
    warning: no files found matching 'runtests.py'
    warning: no files found matching '*.py' under directory 'pylibmc'
Installing collected packages: pylibmc
  Running setup.py install for pylibmc
    building '_pylibmc' extension
    gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DUSE_ZLIB -I/usr/local/include/python2.7 -c src/_pylibmcmodule.c -o build/temp.
    In file included from src/_pylibmcmodule.c:34:
    src/_pylibmcmodule.h:189: error: ‘MEMCACHED_BEHAVIOR_TCP_KEEPALIVE’ undeclared here (not in a function)
    src/_pylibmcmodule.h:256: error: ‘MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA_SPY’ undeclared here (not in a function)
    src/_pylibmcmodule.h:256: error: initializer element is not constant
    src/_pylibmcmodule.h:256: error: (near initialization for ‘PylibMC_distributions[3].flag’)
    src/_pylibmcmodule.h:261: error: ‘MEMCACHED_DISTRIBUTION_CONSISTENT_MAX’ undeclared here (not in a function)
    src/_pylibmcmodule.h:261: error: initializer element is not constant
    src/_pylibmcmodule.h:261: error: (near initialization for ‘PylibMC_distributions[5].flag’)
    src/_pylibmcmodule.c: In function ‘PylibMC_Client_gets’:
    src/_pylibmcmodule.c:571: warning: passing argument 2 of ‘memcached_mget’ from incompatible pointer type
    /usr/include/libmemcached/memcached_get.h:25: note: expected ‘char **’ but argument is of type ‘const char **’
    src/_pylibmcmodule.c: In function ‘pylibmc_memcached_fetch_multi’:
    src/_pylibmcmodule.c:1375: warning: passing argument 2 of ‘memcached_mget’ from incompatible pointer type
    /usr/include/libmemcached/memcached_get.h:25: note: expected ‘char **’ but argument is of type ‘const char **’
    error: command 'gcc' failed with exit status 1
    Complete output from command /home/vagrant/.virtualenvs/cfft2.7/bin/python2.7 -c "import setuptools;__file__='/home/vagrant/.virtualenvs/cfft2.7/build/pylibmc/setup.py';exec(com
    running install

running build

running build_py

running build_ext

building '_pylibmc' extension

gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DUSE_ZLIB -I/usr/local/include/python2.7 -c src/_pylibmcmodule.c -o build/temp.linu

In file included from src/_pylibmcmodule.c:34:

src/_pylibmcmodule.h:189: error: ‘MEMCACHED_BEHAVIOR_TCP_KEEPALIVE’ undeclared here (not in a function)

src/_pylibmcmodule.h:256: error: ‘MEMCACHED_DISTRIBUTION_CONSISTENT_KETAMA_SPY’ undeclared here (not in a function)

src/_pylibmcmodule.h:256: error: initializer element is not constant

src/_pylibmcmodule.h:256: error: (near initialization for ‘PylibMC_distributions[3].flag’)

src/_pylibmcmodule.h:261: error: ‘MEMCACHED_DISTRIBUTION_CONSISTENT_MAX’ undeclared here (not in a function)

src/_pylibmcmodule.h:261: error: initializer element is not constant

src/_pylibmcmodule.h:261: error: (near initialization for ‘PylibMC_distributions[5].flag’)

src/_pylibmcmodule.c: In function ‘PylibMC_Client_gets’:

src/_pylibmcmodule.c:571: warning: passing argument 2 of ‘memcached_mget’ from incompatible pointer type

/usr/include/libmemcached/memcached_get.h:25: note: expected ‘char **’ but argument is of type ‘const char **’

src/_pylibmcmodule.c: In function ‘pylibmc_memcached_fetch_multi’:

src/_pylibmcmodule.c:1375: warning: passing argument 2 of ‘memcached_mget’ from incompatible pointer type

/usr/include/libmemcached/memcached_get.h:25: note: expected ‘char **’ but argument is of type ‘const char **’

error: command 'gcc' failed with exit status 1

----------------------------------------
Command /home/vagrant/.virtualenvs/cfft2.7/bin/python2.7 -c "import setuptools;__file__='/home/vagrant/.virtualenvs/cfft2.7/build/pylibmc/setup.py';exec(compile(open(__file__).read(
Storing complete log in /home/vagrant/.pip/pip.log

有人可以帮忙吗?

4 个答案:

答案 0 :(得分:4)

对我来说有用的是安装以前版本的pylibmc。版本1.3.0无法安装,所以我回到了1.2.3

pip install pylibmc==1.2.3

据我所知,pip并没有很好的方式显示可用的包,有蛋黄,但似乎只列出了pylibmc == 1.3.0。我确信有更好的方法,但运行大量安装(不太可能有实际的安装候选者),它将输出可能性。如果你知道更好的方法,请告诉我。

# pip install pylibmc==12222222
Downloading/unpacking pylibmc==12222222
  Could not find a version that satisfies the requirement pylibmc==12222222 (from versions: 0.2, 0.3, 0.4, 0.5.1, 0.5.2, 0.5.3, 0.5.4, 0.5.5, 0.5, 0.6.1, 0.6, 0.7.1, 0.7.2, 0.7.3, 0.7.4, 0.7, 0.8.1, 0.8.2, 0.8, 0.9.1, 0.9.2, 0.9, 1.0-alpha, 1.0-beta, 1.0, 1.1.1, 1.1, 1.2.0, 1.2.1, 1.2.2, 1.2.3, 1.3.0)
No distributions matching the version for pylibmc==12222222
Storing complete log in /root/.pip/pip.log

答案 1 :(得分:2)

我最终从https://launchpad.net/libmemcached/+download下载了最新的源代码,然后执行了./configure;make ;make install

答案 2 :(得分:1)

我的CentOS盒子今天遇到了类似的问题。通过从EPEL repo安装libmemcached-lastlibmemcached-last-devel来解决此问题。

答案 3 :(得分:1)

每个人似乎都需要一些不同的东西!在Red Hat EL 6.5上,我需要在EPEL之上安装IUS存储库。同样的回购也适用于CentOS 6.5。这允许我安装libmemcached 1.0.16。

Rackspace's guide开始,安装IUS:

# First install EPEL
wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
sudo rpm -Uvh epel-release-6*.rpm
# Then install IUS for RHEL 6.5
wget http://dl.iuscommunity.org/pub/ius/stable/RedHat/6/x86_64/ius-release-1.0-13.ius.el6.noarch.rpm
sudo rpm -Uvh ius-release*.rpm
# Or for CentOS 6.5
wget http://dl.iuscommunity.org/pub/ius/stable/CentOS/6/x86_64/ius-release-1.0-13.ius.centos6.noarch.rpm
sudo rpm -Uvh ius-release*.rpm

之后我可以安装一个更新的libmemcached(注意不同的包名称):

sudo yum install libmemcached10
sudo yum install libmemcached10-devel

之后,最新版本的pylibmc像魅力一样安装:

pip install pylibmc