OS: Debian 8
Python: v3.4.2 (uninstalled v2.7 and v3.5 in order to reduce possible root causes)
I installed pip for Python 3 as per documentation:
sudo apt install python3-venv python3-pip
Afterwards, checking the version results in a SyntaxError:
$ python3 -m pip --version
Traceback (most recent call last):
File "/usr/lib/python3.4/runpy.py", line 170, in _run_module_as_main
"__main__", mod_spec)
File "/usr/lib/python3.4/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/usr/local/lib/python3.4/dist-packages/pip/__main__.py", line 21, in <module>
from pip._internal.cli.main import main as _main
File "/usr/local/lib/python3.4/dist-packages/pip/_internal/cli/main.py", line 60
sys.stderr.write(f"ERROR: {exc}")
^
SyntaxError: invalid syntax
Please note the path to Python version 3.4, while the following check points to version 3.5:
$ pip --version
Traceback (most recent call last):
File "/usr/local/bin/pip", line 7, in <module>
from pip._internal.cli.main import main
File "/usr/local/lib/python3.5/site-packages/pip/_internal/cli/main.py", line 60
sys.stderr.write(f"ERROR: {exc}")
^
SyntaxError: invalid syntax
However, which pip points to another path:
$ which pip
/usr/local/bin/pip
What is going wrong? How can I fix PIP?
I need it to install the tool elastalert.
What I have tried so far:
- Uninstalled PIP for Python 3.5 and checked version again.
- Uninstalled PIP for Python 2.7 and checked version again.
- Uninstalled Python v3.5 (
apt remove --purge
) and checked version again. - Uninstalled Pyton v2.7 and checked version again.
- Uninstalled Python v3.4 and checked version again.
- Re-installed Pyhton v3.4 and checked version again.