Solution: 1. Use "vim /etc/sudoers" to edit "/etc/sudoers" and change "Defaults env_reset" to "Defaults !env_reset"; 2. Use "vim ~/.bashrc" , add "alias sudo='sudo env PATH=$PATH'".
#The operating environment of this tutorial: linux7.3 system, Dell G3 computer.
Problem description:
After we install pip for Linux and use pip install to install the python package, we still prompt: sudo: pip: command not found
Solution:
(1) Edit /etc/sudoers:
sudo vim /etc/sudoers
Modify Defaults env_reset to:
Defaults !env_reset
(2) Edit the configuration file ~/.bashrc:
sudo vim ~/.bashrc
Add:
alias sudo='sudo env PATH=$PATH'
Make the modification effective:
source ~/.bashrc
At this time, use sudo The pip installation can be installed successfully.
Recommended learning: Linux video tutorial
The above is the detailed content of What should I do if the pip command cannot be found in Linux?. For more information, please follow other related articles on the PHP Chinese website!