1、報錯內容:
django.core.cache.backends.base.InvalidCacheBackendError: Could not find backend 'django_redis.cache.RedisCache': cannot import name 'six'
2、措施
(1)需要安裝低版本的 Django
pip3 install django==2.2.7
(2)安裝完成,運行,還是會報錯,如下
File "/usr/local/lib/python3.6/site-packages/django/db/backends/mysql/operations.py", line 146, in last_executed_query
query = query.decode(errors='replace')
AttributeError: 'str' object has no attribute 'decode'
(3)根據報錯進行修改源文件
# 注意:這里每個人的路徑可能不一樣,需要根據報錯自己看一下文件路徑 vim /usr/local/lib/python3.6/site-packages/django/db/backends/mysql/operations.py # 編輯文件,輸入 :set number i # 找到146行,將 decode 改成 encode
保存退出,重啟 Django即可