首页 > 解决方案 > PIP:我可以忽略错误的 Python 2.7 EOL 警告吗?

问题描述

皮普 说:

# ./get-pip.py
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.

这个消息可能只是个玩笑,因为我的系统安装了 Python3.5:

% python3.5
Python 3.5.2 (default, Jan 26 2021, 13:30:48) 
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>

当然,由版本控制专家编写的 Pip足够聪明,可以注意到这一点。但是,当我尝试运行 pip 时,我不再笑了。皮普 说:

% pip
Traceback (most recent call last):
  File "/usr/local/bin/pip", line 5, in <module>
    from pip._internal.cli.main import main
  File "/home/user/.local/lib/python2.7/site-packages/pip/_internal/cli/main.py", line 60
    sys.stderr.write(f"ERROR: {exc}")
                                   ^
SyntaxError: invalid syntax

Pip——一个版本系统——肯定知道如何调用编写 Pip 本身的 Python 版本吗?到底是怎么回事?

标签: python-3.xpython-2.7pip

解决方案


推荐阅读