如果注册xadmin出现了这个错误

如果注册xadmin出现了这个错误,不要担心

(luffyapi) F:\python36\项目\weekwork>python manage.py makemigrations
Traceback (most recent call last):
File "manage.py", line 21, in
main()
File "manage.py", line 17, in main
execute_from_command_line(sys.argv)
File "G:\luffyapi\lib\site-packages\django\core\management_init_.py", line 401, in execute_from_command_line
utility.execute()
File "G:\luffyapi\lib\site-packages\django\core\management_init_.py", line 377, in execute
django.setup()
File "G:\luffyapi\lib\site-packages\django_init_.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "G:\luffyapi\lib\site-packages\django\apps\registry.py", line 114, in populate
app_config.import_models()
File "G:\luffyapi\lib\site-packages\django\apps\config.py", line 211, in import_models
self.models_module = import_module(models_module_name)
File "f:\python36\lib\importlib_init_.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 994, in _gcd_import
File "", line 971, in _find_and_load
File "", line 955, in _find_and_load_unlocked
File "", line 665, in _load_unlocked
File "", line 678, in exec_module
File "", line 219, in _call_with_frames_removed
File "G:\luffyapi\lib\site-packages\xadmin\models.py", line 11, in
from django.utils.encoding import python_2_unicode_compatible, smart_text
ImportError: cannot import name 'python_2_unicode_compatible'

这是你的pip需要更新了按照他的提示去做,首先更新你的pip模块
python -m pip install --upgrade pip

然后重新给你的django降级到2.0

posted on 2020-05-24 19:02  程序员之光  阅读(343)  评论(0编辑  收藏  举报