gpt4 book ai didi

python - 锁不适用于 redis-py - 未知命令 'EVALSHA'

转载 作者:IT王子 更新时间:2023-10-29 06:14:58 26 4
gpt4 key购买 nike

以下在redis中创建、获取和释放锁:

import redis

redis_url = 'redis://127.0.0.1:6379/'
redis_conn = redis.from_url(redis_url)

l = redis_conn.lock('lock-test')
l.acquire()
l.release()

acquire() 怎么会抛出下面的错误?

Traceback (most recent call last):
File "C:/dev/myproj/test.py", line 11, in <module>
l.acquire()
File "C:\dev\myproj\venv_myproj\lib\site-packages\redis\lock.py", line 111, in acquire
if self.do_acquire(token):
File "C:\dev\myproj\venv_myproj\lib\site-packages\redis\lock.py", line 258, in do_acquire
client=self.redis))
File "C:\dev\myproj\venv_myproj\lib\site-packages\redis\client.py", line 2646, in __call__
return client.evalsha(self.sha, len(keys), *args)
File "C:\dev\myproj\venv_myproj\lib\site-packages\redis\client.py", line 1911, in evalsha
return self.execute_command('EVALSHA', sha, numkeys, *keys_and_args)
File "C:\dev\myproj\venv_myproj\lib\site-packages\redis\client.py", line 565, in execute_command
return self.parse_response(connection, command_name, **options)
File "C:\dev\myproj\venv_myproj\lib\site-packages\redis\client.py", line 577, in parse_response
response = connection.read_response()
File "C:\dev\myproj\venv_myproj\lib\site-packages\redis\connection.py", line 574, in read_response
raise response
redis.exceptions.ResponseError: unknown command 'EVALSHA'

我的设置:python 2.7.8,redis 2.4.5 64bit , win8

最佳答案

升级到最新的 redis 为我解决了这个问题。
我最终从 this repo 构建了 2.8.16 版使用 VS13

关于python - 锁不适用于 redis-py - 未知命令 'EVALSHA',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25928619/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com