虚拟环境中的django-serializers错误

时间:2020-04-01 16:14:40

标签: python django python-3.x pip virtualenv

我正在尝试在虚拟环境中安装django serializers-module。它给了我一个错误,我不知道该如何解决。我在2台计算机和一个vps上尝试过,并得到相同的错误。它可以在虚拟环境之外运行,而不能在内部运行。

这是导致错误的原因:

mkdir test-pi; cd test-pi /; virtualenv -p python3。;源bin /激活; pip install django-serializers;

这是错误

ERROR: Command errored out with exit status 1:
 command: /home/owner2/Dev/BELove/src/belove/test-pi/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-o2kpa85w/django-serializers/setup.py'"'"'; __file__='"'"'/tmp/pip-install-o2kpa85w/django-serializers/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 /tmp/pip-install-o2kpa85w/django-serializers/pip-egg-info
     cwd: /tmp/pip-install-o2kpa85w/django-serializers/
Complete output (6 lines):
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/tmp/pip-install-o2kpa85w/django-serializers/setup.py", line 56
    print "You probably want to also tag the version now:"
                                                         ^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print("You probably want to also tag the version now:")?
----------------------------------------

错误:命令错误,退出状态为1:python setup.py egg_info检查日志以获取完整的命令输出。

2 个答案:

答案 0 :(得分:1)

查看错误消息,它说 print 周围没有括号。在python2中,允许不带括号print语句,但在python3中它们被删除了。

如果你仍然想安装这个包,创建一个使用 python2 作为解释器的虚拟环境,它应该可以工作。但是我不建议这样做,因为python2的官方支持在去年就已经结束了。

答案 1 :(得分:0)

django-serializers,最新版本0.6.0于2012年。代码显然仅适用于Python2。

Homepage已被删除。

恢复:过时的废弃项目。找到一个更好的。