0

When I try to update pip with pip install --upgrade pip I get a syntax error.

WARNING: You are using pip version 19.2.3, however version 21.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

josephmclean@Josephs-MacBook-Pro ~ % pip install --upgrade pip
Traceback (most recent call last):
  File "/usr/local/bin/pip", line 11, in <module>
    load_entry_point('pip==21.0.1', '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.1-py2.7.egg/pip/_internal/cli/main.py", line 60
    sys.stderr.write(f"ERROR: {exc}")
                                   ^
SyntaxError: invalid syntax
Jozott
  • 2,367
  • 2
  • 14
  • 28
Joseph
  • 1
  • 1
  • This happens when you install multiple python versions. Go to `C:\Users\username\AppData\Local\Programs\Python` and delete the python version you're not using. Do it after installing unused python version from control panel. – Talha Feb 17 '21 at 10:50
  • I tried entering that into my terminal but it came up with 'command not found' should I use cd to get there as I am using a mac? – Joseph Feb 17 '21 at 10:58
  • It is not a command navigate to the directory where you've installed python in your mac after uninstalling all python version and delete remaing residuals. You can also clear cache and appdata. After that install a fresh python version – Talha Feb 17 '21 at 11:11
  • a. please use `python -m pip install --upgrade pip`. b. please check whether you use python 3 or python 2. it seems that something in your environment is mixed somehow (plus, as @Talha mentioned, you have residuals - meaning you have multiple pip versions. though I myself would not have removed the python) – Koko Jumbo Feb 17 '21 at 11:18

0 Answers0