0

When i try to uninstall pip, I am getting the error below

$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

I ran whereis pip to know the location it is installed. It returned

/usr/bin/pip /usr/bin/pip2.7

When I was trying to install pip, I tried yum install python27-python-pip and then easy_install pip by mistake from where it started to error out like this. How can I fix this ?

1

1 Answer 1

0

PIP community discontinued the support to 2.7. You will have to upgrade pip to latest version.

pip install -upgrade pip  
2
  • Welcome to the site, and thank you for your contribution. You may want to add a link to the site where you found the discontinuation notice. Also, it might be of interest to other readers why the lack of python 2.7 support would lead to complains about a syntax error.
    – AdminBee
    Feb 26, 2021 at 10:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.