Sys.stderr.write(f"ERROR: {exc}") appears after upgrading pip

created at 08-31-2021 views: 237

Recently, when using pip on ubuntu16.04, it prompts to upgrade, and an error is reported after the upgrade.

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


Find the corresponding python version on and click to get the following picture:

 corresponding python version

Right-click on the file and select copy link address;
Execute on the terminal of ubuntu16.04 for python3:


the same for python2:


PS: Because the obtained by python2 and python3 wget has the same name, the system will name the second downloaded as, and run it directly with the corresponding version of python.

created at:08-31-2021
edited at: 08-31-2021: