安装python - memcached

0.目标
安装 pylibmc  http://pypi.python.org/packages/source/p/pylibmc/pylibmc-1.1.1.tar.gz#md5=e43c54e285f8d937a3f1a916256ecc85

1.环境
Ubuntu Server 10.04 已经安装了 gcc, python2.6.5和dev包
sudo apt-get install gcc make binutils
sudo apt-get install python  python-all-dev


2.依赖
libevent     http://monkey.org/~provos/libevent-1.4.13-stable.tar.gz
[?] zlib         http://zlib.net/zlib-1.2.5.tar.gz
memcached    http://memcached.googlecode.com/files/memcached-1.4.5.tar.gz
libmemcached http://launchpad.net/libmemcached/1.0/0.40/+download/libmemcached-0.40.tar.gz

3.安装
tar xzf libevent-1.4.13.tar.gz
cd libevent-1.4.13
./configure --prefix=/opt/lib/libevent-1.4.13
make && sudo make install
cd ..

tar xzf zlib-1.2.5.tar.gz
cd zlib-1.2.5
./configure --prefix=/opt/lib/zlib-1.2.5
make && sudo make install
cd ..

tar xzf memcached-1.4.5.tar.gz
cd memcached-1.4.5
./configure --prefix=/opt/memcached-1.4.5 \
--with-libevent=/opt/lib/libevent-1.4.13
make && sudo make install
cd ..

tar xzf libmemcached-0.40.tar.gz
cd libmemcached-0.40
./configure --prefix=/opt/lib/libmemcached-0.40 \
--with-memcached
make && sudo make install
ln -s /opt/lib/libmemcached-0.40/lib/libmemcached.so.5 /usr/lib/libmemcached.so.5
cd ..

tar xzf pylibmc-1.1.1.tar.gz
cd pylibmc-1.1.1
sudo python setup.py build --with-libmemcached=/opt/lib/libmemcached-0.40
sudo python setup.py install
cd ..


4.冲突
a) 不安装 python2.6-dev (包含在python-all-dev中)在pylibmc的编译阶段会报错:缺少'Python.h'文件
b) 不建立软链接 libmemcached.so.5 到 /usr/lib会提示 找不到libmemcached.so
上一篇:Python中的时间日期转换


下一篇:swift语言IOS8开发战记12 Font Of Label