i am having a trouble with pip and pip3. I am trying to install requirements and it shows an error. When i write pip3 or pip --version it show this error.
jumphost@jumphost-VirtualBox:~$ pip3 --version
Traceback (most recent call last):
File "/usr/bin/pip3", line 9, in <module>
from pip import __main__
File "/usr/local/lib/python3.5/dist-packages/pip/__main__.py", line
21, in <module>
from pip._internal.cli.main import main as _main
File
"/usr/local/lib/python3.5/dist-packages/pip/_internal/cli/main.py", line 60
sys.stderr.write(f"ERROR: {exc}")
^
SyntaxError: invalid syntax
If i am trying to install, it showed this
jumphost@jumphost-VirtualBox:~/kubespray$ pip install -r requirements.txt
Traceback (most recent call last):
File "/usr/bin/pip", line 9, in <module>
from pip import __main__
File
"/usr/local/lib/python2.7/dist-packages/pip-21.0-py2.7.egg/pip/__main__.py",
line 21, in <module>
from pip._internal.cli.main import main as _main
File
"/usr/local/lib/python2.7/dist-packages/pip-21.0-py2.7.egg/pip/_internal/cli/main.py",
line 60
sys.stderr.write(f"ERROR: {exc}")
^
SyntaxError: invalid syntax
jumphost@jumphost-VirtualBox:~/kubespray$ pip3 install -r requirements.txt
Traceback (most recent call last):
File "/usr/bin/pip3", line 9, in <module>
from pip import __main__
File "/usr/local/lib/python3.5/dist-packages/pip/__main__.py", line
21, in <module>
from pip._internal.cli.main import main as _main
File
"/usr/local/lib/python3.5/dist-packages/pip/_internal/cli/main.py", line 60
sys.stderr.write(f"ERROR: {exc}")
^
SyntaxError: invalid syntax
I didn't found a right answer so this is the reason why i ask you. Thanks ! I tried remove python, pip, python3 and pip3 multipletimes but still same problem.
pip has dropped support for Python 2 and 3.5. You will need to use a version-specific branch, assuming that your Python version is 3.5:
curl -fsSL https://bootstrap.pypa.io/pip/3.5/get-pip.py | python3.5
get-pip.py
reference: https://pip.pypa.io/en/stable/installing/#installing-with-get-pip-py
Related: How can I install a legacy PIP version with python 2.6.6 or python 2.7.5?
Better yet, as suggested in the comments, install a newer version of Python that is not end-of-life.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With