如何解决错误“错误:命令错误,退出状态1:python。”尝试使用pip安装djangorestframework-extensions时

时间:2020-03-04 11:01:15

标签: python django linux

我正在尝试使用以下命令安装djangorestframework-extensions:

pip install djangorestframework-extensions

并显示错误:

 ERROR: Command errored out with exit status 1:
     command: /home/anamaria/workspace/licenta/AllFest2/festivals/venv/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-r9q6vdlo/djangorestframework-extensions/setup.py'"'"'; __file__='"'"'/tmp/pip-install-r9q6vdlo/djangorestframework-extensions/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-r9q6vdlo/djangorestframework-extensions/pip-egg-info
         cwd: /tmp/pip-install-r9q6vdlo/djangorestframework-extensions/
    Complete output (6 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-r9q6vdlo/djangorestframework-extensions/setup.py", line 48
        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:")?
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

我该怎么办?

1 个答案:

答案 0 :(得分:0)

此软件包似乎在Python2和python3之间不兼容。 您可以尝试通过手工将所有'''print something'''替换为'''print(something)'''来修复“ /tmp/pip-install-r9q6vdlo/djangorestframework-extensions/setup.py” 它可能会失败,因此,如果您有选择,最好使用python 2运行它,尽管python 2现在已经老了。