redis python_安装 python 的 redis 客户端

安装 python 的 redis 客户端

1,下载 ez_setup.py

wget -q http://peak.telecommunity.com/dist/ez_setup.py

2, 运行 ez_setup.py 安装 setuptools

sudo python ez_setup.py

Downloading http://pypi.python.org/packages/2.7/s/setuptools/setuptools-0.6c11-py2.7.egg

Processing setuptools-0.6c11-py2.7.egg

Copying setuptools-0.6c11-py2.7.egg to /usr/local/lib/python2.7/dist-packages

Adding setuptools 0.6c11 to easy-install.pth file

Installing easy_install script to /usr/local/bin

Installing easy_install-2.7 script to /usr/local/bin

Installed /usr/local/lib/python2.7/dist-packages/setuptools-0.6c11-py2.7.egg

Processing dependencies for setuptools==0.6c11

Finished processing dependencies for setuptools==0.6c11

3,通过运行 setuptools 的easy_install 包来安装 redis 包以及 hiredis包

redis 包为 Python 提供了一个连接至 Redis 的接口。

hiredis包 是一个 C 库,它可以提高 Python de Redis 客户端的速度。

sudo python -m easy_install redis hiredis

Searching for redis

Reading http://pypi.python.org/simple/redis/

Best match: redis 2.10.5

Downloading https://pypi.python.org/packages/68/44/5efe9e98ad83ef5b742ce62a15bea609ed5a0d1caf35b79257ddb324031a/redis-2.10.5.tar.gz#md5=3b26c2b9703b4b56b30a1ad508e31083

Processing redis-2.10.5.tar.gz

Running redis-2.10.5/setup.py -q bdist_egg --dist-dir /tmp/easy_install-cGi0Hb/redis-2.10.5/egg-dist-tmp-uJ77Ej

warning: no previously-included files found matching '__pycache__'

warning: no previously-included files matching '*.pyc' found under directory 'tests'

zip_safe flag not set; analyzing archive contents...

Adding redis 2.10.5 to easy-install.pth file

Installed /usr/local/lib/python2.7/dist-packages/redis-2.10.5-py2.7.egg

Processing dependencies for redis

Finished processing dependencies for redis

Searching for hiredis

Reading http://pypi.python.org/simple/hiredis/

Best match: hiredis 0.2.0

Downloading https://pypi.python.org/packages/1b/98/4766d85124b785ff1989ee1c79631a1b6ecfcb444ff39999a87877b2027e/hiredis-0.2.0.tar.gz#md5=b410cf2f2062d87ab841c33d8345761e

Processing hiredis-0.2.0.tar.gz

Running hiredis-0.2.0/setup.py -q bdist_egg --dist-dir /tmp/easy_install-4qp8i2/hiredis-0.2.0/egg-dist-tmp-QDdm7R

warning: no previously-included files found matching 'vendor/hiredis/example*'

warning: no previously-included files found matching 'vendor/hiredis/text*'

In file included from src/hiredis.c:1:0:

src/hiredis.h:4:20: fatal error: Python.h: 没有那个文件或目录

compilation terminated.

error: Setup script exited with error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

问题解决:

方法一 (未起作用)

gao@gao-VirtualBox:/var/www/redis-3.2.3/deps/hiredis$ sudo make install

mkdir -p /usr/local/include/hiredis /usr/local/lib

cp -a hiredis.h async.h adapters /usr/local/include/hiredis

cp -a libhiredis.so /usr/local/lib/libhiredis.so.0.11

cd /usr/local/lib && ln -sf libhiredis.so.0.11 libhiredis.so.0

cd /usr/local/lib && ln -sf libhiredis.so.0 libhiredis.so

cp -a libhiredis.a /usr/local/lib

gao@gao-VirtualBox:/var/www/redis-3.2.3/deps/hiredis$

方法(二)

gao@gao-VirtualBox:/var/www$ sudo apt-get install python-dev

gao@gao-VirtualBox:/var/www$ sudo python -m easy_install hiredis

Searching for hiredis

Reading http://pypi.python.org/simple/hiredis/

Best match: hiredis 0.2.0

Downloading https://pypi.python.org/packages/1b/98/4766d85124b785ff1989ee1c79631a1b6ecfcb444ff39999a87877b2027e/hiredis-0.2.0.tar.gz#md5=b410cf2f2062d87ab841c33d8345761e

Processing hiredis-0.2.0.tar.gz

Running hiredis-0.2.0/setup.py -q bdist_egg --dist-dir /tmp/easy_install-NF3WyD/hiredis-0.2.0/egg-dist-tmp-k5KIsj

warning: no previously-included files found matching 'vendor/hiredis/example*'

warning: no previously-included files found matching 'vendor/hiredis/text*'

zip_safe flag not set; analyzing archive contents...

Adding hiredis 0.2.0 to easy-install.pth file

Installed /usr/local/lib/python2.7/dist-packages/hiredis-0.2.0-py2.7-linux-x86_64.egg

Processing dependencies for hiredis

Finished processing dependencies for hiredis

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值