如何安装pylibmc(memcached的python客户端)?

时间:2012-01-26 01:06:11

标签: python memcached python-memcached

我正在尝试按照此处的说明安装pylibmc: http://sendapatch.se/projects/pylibmc/install.html

我从这里下载了最新版本的pylibmc:http://pypi.python.org/pypi/pylibmc

我从这里下载了libmemcached(0.51):http://launchpad.net/libmemcached/1.0/0.51/+download/libmemcached-0.51.tar.gz

我正在运行Ubuntu 10.04,我也尝试在Debian Lenny VM上安装它。

这是我得到的错误:

atif@atif-laptop:~/pylibmc-1.2.2$ python setup.py install --with-libmemcached=/home/atif/libmemcached-0.51
running install
running build
running build_py
running build_ext
building '_pylibmc' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DUSE_ZLIB -I/home/atif/libmemcached-0.51/include -I/usr/include/python2.6 -c _pylibmcmodule.c -o build/temp.linux-i686-2.6/_pylibmcmodule.o -fno-strict-aliasing
In file included from _pylibmcmodule.c:34:
_pylibmcmodule.h:41:20: error: Python.h: No such file or directory
In file included from _pylibmcmodule.c:34:
_pylibmcmodule.h:85: error: expected specifier-qualifier-list before ‘PyObject’
_pylibmcmodule.h:103: error: expected specifier-qualifier-list before ‘PyObject’
_pylibmcmodule.h:111: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token

我不知道为什么会这样说:_pylibmcmodule.h:41:20:错误:Python.h:没有这样的文件或目录

我做错了什么?

1 个答案:

答案 0 :(得分:8)

听起来你错过了python开发标题。

sudo apt-get install python2.7-dev

通过

更改为正确的python版本