python3
sudo apt-get install python3-pip
python2
sudo apt-get install python-pip
If it still does not work, follow the steps below
Reason: The -with-secure-path option was added when compiling sudo.
Solution: add an alias to the environment configuration file
(1) vi ~/.bashrc
Add the following content:
alias sudo=’sudo env PATH=$PATH’
(2) source ~/.bashrc