close

[Solved] pip installing is not working in python < 3.6

Hello Guys, How are you all? Hope You all Are Fine. I am trying to install pip But pip installing is not working in python < 3.6 in Python. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How pip installing is not working in python < 3.6?

I am trying to install pip But get-pip.py returns SyntaxError: invalid syntax in Python. I am installed pip from this command

curl https://bootstrap.pypa.io/get-pip.py --output get-pip.py

and when I did sudo python2 get-pip.py

Traceback (most recent call last):
  File "get-pip.py", line 24226, in <module>
    main()
  File "get-pip.py", line 199, in main
    bootstrap(tmpdir=tmpdir)
  File "get-pip.py", line 82, in bootstrap
    from pip._internal.cli.main import main as pip_entry_point
  File "/tmp/tmpf3jeCG/pip.zip/pip/_internal/cli/main.py", line 60
    sys.stderr.write(f"ERROR: {exc}")
                                   ^
SyntaxError: invalid syntax

How To Solve pip installing is not working in python < 3.6?

  1. How To Solve pip installing is not working in python < 3.6?

    Here pip 21.0 dropped support for Python 2 and 3.5. The later versions require Python 3.6+. To install pip for Python 2.7 install it from https://bootstrap.pypa.io/pip/2.7/. The last command is to upgrade to the latest supported version. For Python 2.7 the latest supported is currently pip 20.3.4.

Solution 1

Here pip 21.0 dropped support for Python 2 and 3.5. The later versions require Python 3.6+. To install pip for Python 2.7 install it from https://bootstrap.pypa.io/pip/2.7/

- curl -O https://bootstrap.pypa.io/pip/2.7/get-pip.py
- python get-pip.py
- python -m pip install --upgrade "pip < 21.0"

The last command is to upgrade to the latest supported version. For Python 2.7 the latest supported is currently pip 20.3.4.

For Python 3.4

- curl -O https://bootstrap.pypa.io/pip/3.4/get-pip.py
- python get-pip.py
- python -m pip install --upgrade "pip < 19.2"

For Python 3.5

- curl -O https://bootstrap.pypa.io/pip/3.5/get-pip.py
- python get-pip.py

Solution 2

firstly run

python -m pip install --upgrade "pip < 19.2"

and then

python -m pip install --upgrade "pip < 21.0".

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you?

Also Read

Leave a Comment