当我尝试卸载 pip 时,出现以下错误
$python2.7 -m pip uninstall pip
Traceback (most recent call last):
File "/usr/lib64/python2.7/runpy.py", line 162, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "/usr/lib64/python2.7/runpy.py", line 72, in _run_code
exec code in run_globals
File "/usr/lib/python2.7/site-packages/pip-21.0.1-py2.7.egg/pip/__main__.py", line 21, in <module>
from pip._internal.cli.main import main as _main
File "/usr/lib/python2.7/site-packages/pip-21.0.1-py2.7.egg/pip/_internal/cli/main.py", line 60
sys.stderr.write(f"ERROR: {exc}")
^
SyntaxError: invalid syntax
我跑去whereis pip
了解它的安装位置。它回来了
/usr/bin/pip /usr/bin/pip2.7
当我尝试安装 pip 时,我尝试了yum install python27-python-pip
,然后easy_install pip
错误地从哪里开始出现这样的错误。我怎样才能解决这个问题 ?
答案1
PIP 社区停止了对 2.7 的支持。您必须将 pip 升级到最新版本。
pip install -upgrade pip