redis.exceptions.DataError: Invalid input of type: ‘dict‘. Convert to a byte, string or number first

redis.exceptions.DataError: Invalid input of type: ‘dict‘. Convert to a byte, string or number first,第1张

redis.exceptions.DataError: Invalid input of type: ‘dict‘. Convert to a byte, string or number first

一个问题引发的血案:

用python向redis写入数据报错:

redis.exceptions.DataError: Invalid input of type: 'dict'. Convert to a byte, string or number first.

查看redis的版本: 

pip3 freeze

显示现在的redis版本是:

redis 3.5.3

对redis降版:

pip3 install -U redis==2.10.6 #将当前版本降级到2.10.6

成功写入数据。

而上面我之所以说是"血案",是因为我看了网上的教程说是Redis版本太高导致的之后,我就试图将Redis服务端的版本重新安装成低版本的2.10.6,但是发现并不能,最后才顿悟,应该将Python使用的Redis模块的版本降级为2.10.6(这里使用Redis模块,就类似于要在Python中 *** 作MySQL而使用pymysql模块是一样的),而不是去动服务端的版本,无知啊,做个笔记,记录一下.

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/5480660.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-12
下一篇 2022-12-12

发表评论

登录后才能评论

评论列表(0条)

保存