安装djangocms-blog后发生错误:无法从'django.utils .encoding'导入名称'python_2_unicode_compatible'(示

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了安装djangocms-blog后发生错误:无法从'django.utils .encoding'导入名称'python_2_unicode_compatible'(示相关的知识,希望对你有一定的参考价值。

我当前安装了django-cmsdjangocms-blog。当我运行migrate时,它将引发以下错误。一些资源建议安装six,但是我的系统已经满足了。

我使用最新的Python,pip和django版本。

这些是我遵循的设置djangocmsdjangocms-blog的指南。

对此有任何解决方案?

Requirement already satisfied: webencodings in c:usersjonasappdatalocalprog
ramspythonpython38-32libsite-packages (from html5lib>=0.999999999->djangocms
-text-ckeditor>=3.5->djangocms-blog) (0.5.1)
Requirement already satisfied: asgiref~=3.2 in c:usersjonasappdatalocalprog
ramspythonpython38-32libsite-packages (from django>=1.1->django-taggit-templ
atetags->djangocms-blog) (3.2.3)
Requirement already satisfied: sqlparse>=0.2.2 in c:usersjonasappdatalocalp
rogramspythonpython38-32libsite-packages (from django>=1.1->django-taggit-te
mplatetags->djangocms-blog) (0.3.0)
Collecting django-js-asset
  Downloading django_js_asset-1.2.2-py2.py3-none-any.whl (5.8 kB)
Building wheels for collected packages: djangocms-text-ckeditor, django-taggit-t
emplatetags, django-filer, easy-thumbnails, django-sekizai, django-treebeard, dj
ango-classy-tags, djangocms-admin-style, django-appdata
  Building wheel for djangocms-text-ckeditor (setup.py) ... done
  Created wheel for djangocms-text-ckeditor: filename=djangocms_text_ckeditor-3.
9.0-py3-none-any.whl size=2009460 sha256=7f2a93b1858ad9c776ea9d286bf96924070a8d7
03ffb5d4510f3b74d39ca57d2
  Stored in directory: c:usersjonasappdatalocalpipcachewheelsc7b1ee3
908562c925cdc1dbcd7c4bd2447f8a11f6716a7d99f3c04b
  Building wheel for django-taggit-templatetags (setup.py) ... done
  Created wheel for django-taggit-templatetags: filename=django_taggit_templatet
ags-0.2.5-py3-none-any.whl size=7824 sha256=798816cf8c5154b3cd9d133dd906c8e40945
53de30f114a76fe8829d08a7c66c
  Stored in directory: c:usersjonasappdatalocalpipcachewheels82a46654
1f4c683657632200e1e8ea3a89698e88ede94c1232365f00
  Building wheel for django-filer (setup.py) ... done
  Created wheel for django-filer: filename=django_filer-1.7.1-py3-none-any.whl s
ize=1572351 sha256=89983e63dedf4ecef67b3c0f929f9cf53281cd232a8afa72e9c97e2b3d9e3
d34
  Stored in directory: c:usersjonasappdatalocalpipcachewheels126cdd8
64a98a0a882ae18c7c0551af158f82193a7e5daa88a86572
  Building wheel for easy-thumbnails (setup.py) ... done
  Created wheel for easy-thumbnails: filename=easy_thumbnails-2.7-py2.py3-none-a
ny.whl size=65532 sha256=b0c81ae967ea8073bba11192946e3e2a4af3928c5be5010445c6cf6
d21f37964
  Stored in directory: c:usersjonasappdatalocalpipcachewheelse43fd43c
7af17dfe56f754d3fe9a3c610aaeff28eaad840778039d1f
  Building wheel for django-sekizai (setup.py) ... done
  Created wheel for django-sekizai: filename=django_sekizai-1.1.0-py3-none-any.w
hl size=8501 sha256=895b43796abbfb5a8f4525140a3f96616b0a97ae46f1d17d1ef58ad5acdb
c671
  Stored in directory: c:usersjonasappdatalocalpipcachewheels5fa4f3a
2e3b26fd0c6da68f23e2adfc90a52cd04e3c0a877fe7b295
  Building wheel for django-treebeard (setup.py) ... done
  Created wheel for django-treebeard: filename=django_treebeard-4.3.1-py2.py3-no
ne-any.whl size=104160 sha256=96537f1f9de03bb552d47ddb90ebfaf6016d6b771f3e12605d
d706f8a67880ed
  Stored in directory: c:usersjonasappdatalocalpipcachewheels766357a
77f284b71e8aa5afd08c85f1968bcfdc8106f12837ce32eb
  Building wheel for django-classy-tags (setup.py) ... done
  Created wheel for django-classy-tags: filename=django_classy_tags-1.0.0-py3-no
ne-any.whl size=14275 sha256=0b6b349b241b4a668360c2de1fbf931de6110451365ceaf0ef1
33a52298c8eb8
  Stored in directory: c:usersjonasappdatalocalpipcachewheels6440968c
0ee90f1bf065766a881f22ee8bc54afeb3323989569d4c90
  Building wheel for djangocms-admin-style (setup.py) ... done
  Created wheel for djangocms-admin-style: filename=djangocms_admin_style-1.5.0-
py3-none-any.whl size=400280 sha256=791618cc13eb3d1347d84c54a12dce88323f656aa64a
2451712ce3c74f32bd34
  Stored in directory: c:usersjonasappdatalocalpipcachewheelsc6559879
73149944c17dbb19598c419fb47139e1f8984bc66bd40731
  Building wheel for django-appdata (setup.py) ... done
  Created wheel for django-appdata: filename=django_appdata-0.2.2-py3-none-any.w
hl size=12418 sha256=42dd18e970075a3f0c33737b5955ad464922c155ed70f5b1eb76d7ddb41
b17a7
  Stored in directory: c:usersjonasappdatalocalpipcachewheels4efa8757
d4ab1d1df54f32b3f74bb567a632f76662b81a270d4eb82a
Successfully built djangocms-text-ckeditor django-taggit-templatetags django-fil
er easy-thumbnails django-sekizai django-treebeard django-classy-tags djangocms-
admin-style django-appdata

// First error

ERROR: django-appdata 0.2.2 has requirement Django<3.0,>=1.8, but you'll have dj
ango 3.0.6 which is incompatible.


Installing collected packages: django-formtools, django-classy-tags, django-seki
zai, django-treebeard, djangocms-admin-style, django-cms, html5lib, djangocms-te
xt-ckeditor, django-taggit, django-templatetag-sugar, django-taggit-templatetags
, django-js-asset, django-mptt, django-polymorphic, easy-thumbnails, Unidecode,
django-filer, django-meta, djangocms-apphook-setup, lxml, django-sortedm2m, djan
go-appdata, aldryn-apphooks-config, django-taggit-autosuggest, django-parler, dj
angocms-blog
Successfully installed Unidecode-1.1.1 aldryn-apphooks-config-0.5.3 django-appda
ta-0.2.2 django-classy-tags-1.0.0 django-cms-3.7.2 django-filer-1.7.1 django-for
mtools-2.2 django-js-asset-1.2.2 django-meta-1.6.1 django-mptt-0.11.0 django-par
ler-2.0.1 django-polymorphic-2.1.2 django-sekizai-1.1.0 django-sortedm2m-3.0.0 d
jango-taggit-1.2.0 django-taggit-autosuggest-0.3.8 django-taggit-templatetags-0.
2.5 django-templatetag-sugar-1.0 django-treebeard-4.3.1 djangocms-admin-style-1.
5.0 djangocms-apphook-setup-0.4.1 djangocms-blog-1.1.0 djangocms-text-ckeditor-3
.9.0 easy-thumbnails-2.7 html5lib-1.0.1 lxml-4.5.0

C:UsersJonasDesktopCFDCFD>python manage.py migrate
Traceback (most recent call last):
  File "manage.py", line 21, in <module>
    main()
  File "manage.py", line 17, in main
    execute_from_command_line(sys.argv)
  File "C:UsersJonasAppDataLocalProgramsPythonPython38-32libsite-packag
esdjangocoremanagement\__init__.py", line 401, in execute_from_command_line
    utility.execute()
  File "C:UsersJonasAppDataLocalProgramsPythonPython38-32libsite-packag
esdjangocoremanagement\__init__.py", line 377, in execute
    django.setup()
  File "C:UsersJonasAppDataLocalProgramsPythonPython38-32libsite-packag
esdjango\__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "C:UsersJonasAppDataLocalProgramsPythonPython38-32libsite-packag
esdjangoapps
egistry.py", line 114, in populate
    app_config.import_models()
  File "C:UsersJonasAppDataLocalProgramsPythonPython38-32libsite-packag
esdjangoappsconfig.py", line 211, in import_models
    self.models_module = import_module(models_module_name)
  File "C:UsersJonasAppDataLocalProgramsPythonPython38-32libimportlib\_
_init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "C:UsersJonasAppDataLocalProgramsPythonPython38-32libsite-packag
esaldryn_apphooks_configmodels.py", line 5, in <module>
    from django.utils.encoding import python_2_unicode_compatible

// Second error

ImportError: cannot import name 'python_2_unicode_compatible' from 'django.utils
.encoding' (C:UsersJonasAppDataLocalProgramsPythonPython38-32libsite-pa
ckagesdjangoutilsencoding.py)

C:UsersJonasDesktopCFDCFD>python -m pip install six
Requirement already satisfied: six in c:usersjonasappdatalocalprogramspyth
onpython38-32libsite-packages (1.14.0)


答案

[python_2_unicode_compatible已从Django在3.0中删除:https://docs.djangoproject.com/en/3.0/releases/3.0/#removed-private-python-2-compatibility-apis

看来您需要更新正在使用它的一个软件包。从回溯来看,该值为aldryn_apphooks_config。我不确定它来自哪里,是否需要更多详细信息。我建议检查您的需求文件并尝试升级软件包,直到它起作用为止,但是您可能最终不得不删除一些文件。

另一答案

在那种情况下,这是一个过时的依赖关系,在我提出请求后,它同时由所有者解决:

https://github.com/nephila/djangocms-blog/issues

以上是关于安装djangocms-blog后发生错误:无法从'django.utils .encoding'导入名称'python_2_unicode_compatible'(示的主要内容,如果未能解决你的问题,请参考以下文章

VMware无法重新安装(提示:打开安装日志文件时发生错误...如图)

如何为 djangocms-blog 设置自定义模板?

怎么解决office2007安装时出现的错误

VMware虚拟机安装时“当前页面的脚本发生错误”,如何解决?

在“计算启动按钮工具提示”期间发生内部错误。安装TestNG后使用Eclipse Kepler的java.lang.IllegalArgumentException

"virtualbox"安装时发生严重错误,怎么解决?