Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pip install failing on python2

Following the instructions on this page to install pip on python2 https://linuxhint.com/installing_pip_linux_mint/

It's failing at the last step, $ sudo python2 get-pip.py

with this error,

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/tmp2aZyDl/pip.zip/pip/_internal/cli/main.py", line 60     sys.stderr.write(f"ERROR: {exc}")                                    ^ SyntaxError: invalid syntax 

I've tried to look everywhere for a solution, but can't find one. What is it that I'm doing wrong?

like image 299
Hsarp Avatar asked Jan 24 '21 01:01

Hsarp


People also ask

Why is pip install not working in Python?

One of the most common problems with running Python tools like pip is the “not on PATH” error. This means that Python cannot find the tool you're trying to run in your current directory. In most cases, you'll need to navigate to the directory in which the tool is installed before you can run the command to launch it.

Is pip for python2?

pip installationTo use pip, first install a custom version of Python 2. pip is then installed with it. You can then use the pip command to create a virtualenv and install modules.

Does Python 2.6 have pip?

pip works with CPython versions 2.6, 2.7, 3.1, 3.2, 3.3, 3.4 and also pypy.

Does pip work Python 2 and 3?

The approach you should take is to install pip for Python 3.2. Then, you can install things for Python 3.2 with pip-3.2 , and install things for Python 2-7 with pip-2.7 .


1 Answers

The correct get-pip.py file for python2 has been moved to https://bootstrap.pypa.io/pip/2.7/get-pip.py

like image 186
Hsarp Avatar answered Oct 07 '22 11:10

Hsarp