使用redis-py 2.10.5版本时出现xadd未找到错误,原因何在?
Hey there, let's break down exactly why this error is popping up for you—it all boils down to version compatibility between Redis and the redis-py client:
Redis Streams didn't exist when your redis-py version was built
TheXADDcommand (which thexadd()method wraps) is part of Redis Streams, a feature that wasn't introduced until Redis 5.0. Your redis-py 2.10.5 is an older release that predates the addition of Streams support entirely.redis-py added
xadd()support in version 3.0.0
Thexadd()method wasn't included in the redis-py client until the 3.0.0 update. Any version before that (like your 2.10.5) simply doesn't have this method implemented in its codebase.
Quick Steps to Fix This:
- Upgrade redis-py to 3.x or newer
Run this command to get a version that supports Streams:pip install --upgrade redis>=3.0.0 - Verify your Redis server version is at least 5.0
Even with an updated client, your Redis server needs to support Streams to usexadd(). Check your server version with:redis-server --version
内容的提问来源于stack exchange,提问作者user2757185




