'"Could not open lock file /var/lib/dpkg/lock-frontend" error upon installing python and pip

I tried to install python and pip, but I get the following error message in the terminal.

apt-get install python3-pip

E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root? 

How can I resolve this?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source