I'm using Python 2.7 in centos 7.9, but when I installed pip to yum and upgraded, all the pip-related commands are error below... You have to use Python2, but what's wrong with this?
Before the pip upgrade, the --version command worked well, but now it doesn't work at all.
Just in case, I attach it in text.
[root@node00 build]# pip --version
Traceback (most recent call last):
File "/usr/bin/pip", line 7, in <module>
from pip._internal.cli.main import main
File "/usr/lib/python2.7/site-packages/pip/_internal/cli/main.py", line 60
sys.stderr.write(f"ERROR: {exc}")
^
SyntaxError: invalid syntax
I don't know what to do, but I know why.
Python's f-string (f"blah, {var}"
format string) is a supported grammar from Python 3, but as the pip is updated, the pip source code of the unsupported grammar is updated, causing a problem. .write(f"ERROR: {exc}")
This part.
Python 2 is now legacy, so I don't think the pip source considered compatibility with Python 2.
As I looked it up, I have a question about the same problem in the stack overflow.
https://stackoverflow.com/questions/65866417/pip-install-failing-on-python2
© 2024 OneMinuteCode. All rights reserved.