如果注册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 "
File "
File "
File "
File "
File "
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