django3.x 使用haystack 报错:ImportError: cannot import name 'six' from 'django.utils'

原因

django 3.x 系列删除了six.

第一步:安装six

pip3 install six

第二步

cd #进入家目录
cd .local/lib/python3.6/site-packages
cp six.py django/utils #将six.py拷贝进django/utils/目录下

第三步

# 将site-packages/haystack/inputs.py 中
from django.utils.encoding import force_text, python_2_unicode_compatible
# 改为
from django.utils.encoding import force_text
from django.utils.six import python_2_unicode_compatible
# 问题解决

posted on 2020-08-16 13:02  沈家大大  阅读(366)  评论(0编辑  收藏  举报