Linux and opensource world mainly use package management software for installing, updating, and removing software. Python is using pip
or pip3
for Python package management. pip
is Python2 package manager where pip3
is Python3 package manager.
Linux和开源世界主要使用软件包管理软件来安装,更新和删除软件。 Python使用pip
或pip3
进行Python软件包管理。 pip
是Python2软件包管理器,其中pip3
是Python3软件包管理器。
“找不到pip命令”问题 (“pip command not found” Problem)
Command “pip” is used to manage python packages and can be executed from the bash shell like below. We will get an error like pip command not found
when we try to run pip
or pip3
like below.
命令“ pip”用于管理python软件包,可以从bash shell执行,如下所示。 当我们尝试运行如下所示的pip
或pip3
时,将收到pip command not found
类似pip command not found
的错误。
$ pip search django
We can see from the screenshot that “pip” command is not executed and a message like “Command ‘pip3’ not found, but can be installed with: sudo apt install python-pip” is printed to the bash.
从屏幕截图中我们可以看到,“ pip”命令未执行,并且消息显示为“找不到命令'pip3',但可以通过以下命令安装:sudo apt install python-pip”。
$ pip3 search django
We can see from the screenshot that “pip3” command is not executed and a message like “Command ‘pip3’ not found, but can be installed with: sudo apt install python3-pip” is printed to the bash.
从屏幕截图中我们可以看到,“ pip3”命令未执行,并且消息显示为“找不到命令'pip3',但可以使用以下命令安装:sudo apt install python3-pip”。
在Ubuntu,Debian,Mint,Kali中为Python2安装pip软件包 (Install pip Package For Python2 In Ubuntu, Debian, Mint, Kali)
We will install Python2 pip package for deb
based distributions like be Ubuntu, Debian, Mint and Kali. We can use this command for other deb
based distributions as well.
我们将安装Python2 PIP封装deb
基于分布等的Ubuntu,Debian的,薄荷和卡利。 我们也可以将该命令用于其他基于deb
的发行版。
$ sudo apt install python-pip
在CentOS,RHEL,Fedora中为Python2安装pip软件包(Install pip Package For Python2 In CentOS, RHEL, Fedora)
We will install Python2 pip package for rpm
based distributions like Fedora, CentOS, RHEL. We will install with the following command.
我们将为基于rpm
的发行版(如Fedora,CentOS,RHEL)安装Python2 pip软件包。 我们将使用以下命令进行安装。
$ sudo yum install python2-pip
在Ubuntu,Debian,Mint,Kali中为Python3安装pip3软件包(Install pip3 Package For Python3 In Ubuntu, Debian, Mint, Kali)
We will install Python3 pip package for deb
based distributions like be Ubuntu, Debian, Mint and Kali. We can use this command for other deb
based distributions as well.
我们将安装Python3 PIP封装deb
基于分布等的Ubuntu,Debian的,薄荷和卡利。 我们也可以将该命令用于其他基于deb
的发行版。
$ sudo apt install python3-pip
在CentOS,RHEL,Fedora中为Python2安装pip软件包 (Install pip Package For Python2 In CentOS, RHEL, Fedora)
We will install Python3 pip package for rpm
based distributions like Fedora, CentOS, RHEL. We will install with the following command.
我们将为基于rpm
的发行版(如Fedora,CentOS,RHEL)安装Python3 pip软件包。 我们将使用以下命令进行安装。
$ sudo yum install python3-pip
使用easy_install安装 (Install with easy_install)
We can also use Python
provided installation tool named easy_install
. We will run the following command. But easy_install
is provided by python-setuptools
我们还可以使用Python
提供的名为easy_install
安装工具。 我们将运行以下命令。 但是easy_install
由python-setuptools
$ sudo easy_install pip
OR
要么
$ sudo easy_install pip3
为MacOSX安装Pip (Install Pip For MacOSX)
MacOSX provides similar features to the Linux distributions. Pip also provided for the MacOSX operating system. We can install the pip command with following “brew” command.
MacOSX提供与Linux发行版相似的功能。 还为MacOSX操作系统提供了Pip。 我们可以使用以下“ brew”命令安装pip命令。
$ brew install python
打印Pip2和Pip3版本 (Print Pip2 and Pip3 Version)
After installation we may need to get version information about the pip
or pip3
or pip2
. We can use --version
option to print detailed version and site-packages
path.
安装后,我们可能需要获取有关pip
或pip3
或pip2
版本信息。 我们可以使用--version
选项来打印详细的版本和site-packages
路径。
$ pip --version
翻译自: https://www.poftut.com/pip-command-not-found-error-solution-for-linux-debianubuntu-centos-mint/