Everytime I use pip, there is an error, even if I'm just checking the pip version with pip --version
.
I've figured out that this error is due to incompatible versions of pip and Python, so I made sure to upgrade both my pip and python versions to the latest versions available. I also tried to uninstall everything and reinstall only the latest version of both, but to no avail. I figured setting up a virtual environment with only 1 python version might help, but in order to set that up, I need pip working to install virtualenv, so I'm stuck in a loop.
I've already tried stuff like sudo python3 -m pip install --upgrade pip
to upgrade pip and even though I checked the latest python version is installed, I still get the same error:
Traceback (most recent call last):
File "/home/user/.local/bin/pip", line 7, in <module>
from pip._internal.cli.main import main
File "/home/user/.local/lib/python3.5/site-packages/pip/_internal/cli/main.py", line 57
sys.stderr.write(f"ERROR: {exc}")
^
SyntaxError: invalid syntax
When I use pip3 I get the exact same error, but where it says pip
, it is pip3
instead.
I feel like this should be a relatively easy fix but I've read and tried solutions to every similar issue I could find, but none of them worked and I've been stuck on this for days and can't figure out what to do. I'd be grateful for any suggestions.
I'm using a linux VM running Ubuntu 16.04.7.