Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/303.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
将Django项目从Python 2转换为Python 3:pip3安装Django_注释NameError unicode_Python_Django_Django Comments_Python 2to3 - Fatal编程技术网

将Django项目从Python 2转换为Python 3:pip3安装Django_注释NameError unicode

将Django项目从Python 2转换为Python 3:pip3安装Django_注释NameError unicode,python,django,django-comments,python-2to3,Python,Django,Django Comments,Python 2to3,系统信息: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.

系统信息: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.
(env)用户:语言用户$pip3安装django_注释
收集django_评论
使用缓存https://files.pythonhosted.org/packages/c7/df/3a752f3e393b470087304dd47be6a4bad9867e7ec33963ff022d32143700/django-comments-1.0.0.b.tar.bz2
错误:命令出错,退出状态为1:
命令:/Users/user/../env/bin/python3-c'import sys、setuptools、tokenize;sys.argv[0]=“private/var/folders/tb/vbtzyv92hz62qv7x8r8jh0000gn/T/pip-install-xjv_0ird/django comments/setup.py”__文件“'/private/var/folders/tb/vbtzyv92hz62qv7x8r8jh0000gn/T/pip-install-xjv_0ird/django comments/setup.py'”;f=getattr(标记化,“'open'”,open)(\uuuuu文件);code=f.read().replace(“\r\n”“”、“\n”“”);f、 close();exec(编译(代码,uuuu文件,uuuuu,“'exec'”))'egg\u信息——蛋基pip egg信息
cwd:/private/var/folders/tb/vbtzyv92hz62qv7x8r8jh0000gn/T/pip-install-xjv_0ird/django注释/
完整输出(7行):
回溯(最近一次呼叫最后一次):
文件“”,第1行,在
文件“/private/var/folders/tb/vbtzyv92hz62qv7x8r8jh0000gn/T/pip-install-xjv_0ird/django comments/setup.py”,第12行
version=get_version(),
文件“/private/var/folders/tb/vbtzyv92hz62qv7x8r8jh0000gn/T/pip-install-xjv\u 0ird/django comments/django\u comments/\uuuuuuu init\uuuuuuuuuuuu.py”,第4行,在get\u版本中
返回u'.'。连接(映射(unicode,版本))
名称错误:未定义名称“unicode”
----------------------------------------
错误:命令出错,退出状态为1:python setup.py egg_info检查日志以获得完整的命令输出。

我发现一个潜在的解决办法是用
str
替换
unicode
。然而,这是我希望在Python3中使用的一个模块,因为Django项目目前依赖于这个模块进行注释。它是不是已经被弃用了,除了自己重新装备它之外,根本没有办法工作?谢谢。

我知道这有点晚了,但我相信django_的评论已经转移到django contrib评论。应该是最新的文档。

我相信它仍在维护中。使用
pip
将其更新为最新版本时会发生什么情况?django comments似乎是一个8年前上传的库,此后从未修改过。它不可能与Python或Django的最新版本一起工作。但是,有许多注释库需要维护,您应该使用其中的一个:请参阅。