I was testing CARLA, a self-driving car simulator on ubuntu 16.04.5 LTS last year and at that time, I had installed pygame. At that time pygame had been installed under /usr/lib/python2.7/dist-packages/pygame and I had fixed a file there to make it work right.
Now, recently I re-installed ubuntu 16.04.5 LTS for the machine (only the OS part) and tried testing CARLA and found I have to install pygame(which is of course). So I did pip install pygame(without sudo) and CARLA now works again.
But soon I found the location of pygame installation is now not /usr/lib/python2.7/dist-packages/pygame but  ~/.local/lib/python2.7/site-packages/pygame.
Why is it installed in my local home directory, not in the system directory? (I tried installing it with sudo, but it says Requirement alread satisfied.)
I tried python -m pip uninstall pip but received message below. 
 Not uninstalling pip at /usr/lib/python2.7/dist-packages, outside environment /usr
You are using pip version 8.1.1, however version 19.0.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
should I do pip upgrade?
ADD : This question is not about 'sudo' or 'apt install'. Normally in apt install, if we omit sudo, it asks for root priviledge and doesn't install it. But pip installs it under ~/.local. Therefore this question is different from suggested duplicate question.
 
     
    