4

I run latest python 3.9.1 and the pip doesn't work, I tried to install, uninstall and it still gives me the same error (below). I am not sure what's wrong as I tried everything I found on the net, it gives me the invalid syntax error (please see below).

Any ideas on what should I do?

Traceback (most recent call last):
  File "/usr/local/bin/pip", line 11, in <module>
    load_entry_point('pip==21.0', 'console_scripts', 'pip')()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 489, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 2843, in load_entry_point
    return ep.load()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 2434, in load
    return self.resolve()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 2440, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/Library/Python/2.7/site-packages/pip-21.0-py2.7.egg/pip/_internal/cli/main.py", line 60
    sys.stderr.write(f"ERROR: {exc}")
                                   ^
SyntaxError: invalid syntax
janw
  • 8,758
  • 11
  • 40
  • 62
su yan
  • 49
  • 4
  • If it doesn't know what f-strings are, as seems to be the problem according to your error message, then you're not running Python 3.9.1, as you think you are, but some version older than 3.6. – Thierry Lathuille Jan 24 '21 at 20:31
  • How do you try to run pip? Have you tried `python3.9 -m pip [command]`? – e.Fro Jan 24 '21 at 20:32
  • apoligies I accidentally pasted another error code from another post I was reading! I changed the post can you have a look again! I tried running uninstall commands and reinstall but every-time I try it gives me this error – su yan Jan 24 '21 at 20:39
  • 1
    How did you even *install* `pip`? Somehow, you installed it as part of your Python 2.7 installation, which absolutely does not support f-strings. – chepner Jan 24 '21 at 22:00
  • Check [this answer](https://stackoverflow.com/a/65871131/1365018) – 6utt3rfly Jan 25 '21 at 17:52
  • I installed it when I was on python 2.7 but then I updated it to 3.9.1 but the pip is sort of working but I cant uninstall it for instance! Wonder why – su yan Jan 25 '21 at 19:03

0 Answers0