I have gone through some notes that it is not a good idea to do pip upgrade using sudo command. My question is if I don't give sudo I get permission errors. How can I resolve this? Also, what is the reason sudo is not suggested in order to upgrade pip?
$python -m pip install --upgrade pip
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Collecting pip
Using cached https://files.pythonhosted.org/packages/54/0c/d01aa759fdc501a58f431eb594a17495f15b88da142ce14b5845662c13f3/pip-20.0.2-py2.py3-none-any.whl
Installing collected packages: pip
Found existing installation: pip 19.2.3
Uninstalling pip-19.2.3:
Successfully uninstalled pip-19.2.3
Rolling back uninstall of pip
Moving to /home/abc/.local/bin/pip
from /tmp/pip-uninstall-V4F8Pj/pip
Moving to /home/abc/.local/bin/pip2
from /tmp/pip-uninstall-V4F8Pj/pip2
Moving to /home/abc/.local/bin/pip2.7
from /tmp/pip-uninstall-V4F8Pj/pip2.7
Moving to /home/abc/.local/lib/python2.7/site-packages/pip-19.2.3.dist-info/
from /home/abc/.local/lib/python2.7/site-packages/~ip-19.2.3.dist-info
Moving to /home/abc/.local/lib/python2.7/site-packages/pip/
from /home/abc/.local/lib/python2.7/site-packages/~ip
ERROR: Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/pip-20.0.2.dist-info/top_level.txt'
Consider using the `--user` option or check the permissions.
WARNING: You are using pip version 19.2.3, however version 20.0.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.