redis和redis-py-cluster版本冲突,导致ImportError: cannot import name 'bytes'

from db_base.redis_base import RedisBase
  File "/redis_base.py", line 13, in 
    from rediscluster import RedisCluster
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/rediscluster/__init__.py", line 7, in 
    from .client import RedisCluster
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/rediscluster/client.py", line 11, in 
    from .connection import (
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/rediscluster/connection.py", line 12, in 
    from .nodemanager import NodeManager
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/rediscluster/nodemanager.py", line 12, in 
    from redis._compat import unicode, bytes, long, basestring
ImportError: cannot import name 'bytes'

问题原因是版本不兼容,解决办法,可以下载如下版本:

redis-py-cluster==1.3.6

redis==2.10.6

你可能感兴趣的:(python)