系统信息:64位OS-X、Python 3.7
我正在将一个Django网站从Python 2转换到Python 3。为此,我在整个项目上运行了2to3。然后,我在settings.py的INSTALL_APPS中安装了所有必需的模块--除了一个模块: django_comments。
(env) user:languages user$ pip3 install django_comments
Collecting django_comments
Using cached https://files.pythonhosted.org/packages/c7/df/3a752f3e393b470087304dd47be6a4bad9867e7ec33963ff022d32143700/django-comments-1.0.0.b.tar.bz2
ERROR: Command errored out with exit status 1:
command: /Users/user/.../env/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/tb/vbtzyvv92hz6262qv7x8r8jh0000gn/T/pip-install-xjv_0ird/django-comments/setup.py'"'"'; __file__='"'"'/private/var/folders/tb/vbtzyvv92hz6262qv7x8r8jh0000gn/T/pip-install-xjv_0ird/django-comments/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base pip-egg-info
cwd: /private/var/folders/tb/vbtzyvv92hz6262qv7x8r8jh0000gn/T/pip-install-xjv_0ird/django-comments/
Complete output (7 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/tb/vbtzyvv92hz6262qv7x8r8jh0000gn/T/pip-install-xjv_0ird/django-comments/setup.py", line 12, in <module>
version = get_version(),
File "/private/var/folders/tb/vbtzyvv92hz6262qv7x8r8jh0000gn/T/pip-install-xjv_0ird/django-comments/django_comments/__init__.py", line 4, in get_version
return u'.'.join(map(unicode, VERSION))
NameError: name 'unicode' is not defined
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.我发现这个may be related to compatibility with Python 3和一个潜在的修复方法是用str替换unicode。然而,这是一个我想在Python3中使用的模块,因为Django项目目前依赖于它来进行注释。它基本上被弃用了吗?除了我自己重新装备它之外,没有其他方法可以工作了?谢谢。
发布于 2020-09-01 04:00:15
我知道这有点晚了,但我相信django_comments已经被移到了django-contrib-comments。Here应该是最新的文档。
https://stackoverflow.com/questions/58091930
复制相似问题