Home  >  Article  >  Operation and Maintenance  >  What should I do if the pip command cannot be found in Linux?

What should I do if the pip command cannot be found in Linux?

WBOY
WBOYOriginal
2022-07-19 16:43:148676browse

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'".

What should I do if the pip command cannot be found in Linux?

#The operating environment of this tutorial: linux7.3 system, Dell G3 computer.

What to do if the pip command cannot be found in Linux

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn