bash pip 安装但不工作

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/20869925/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-18 09:07:32  来源:igfitidea点击:

pip installed but not working

pythonbashshellpip

提问by slwr

I'm trying to use PIP on my server but something weird happens.

我正在尝试在我的服务器上使用 PIP,但发生了一些奇怪的事情。

So, I have python 2.7.2 installed, in fact when I run python -VI get:

所以,我安装了 python 2.7.2,实际上当我运行时python -V我得到:

Python 2.7.2 

Then, in my .bashrcthis is what I have:

然后,在我.bashrc这就是我所拥有的:

export PATH=$HOME/.local/bin:$HOME/.local/usr/bin:$PATH
export PATH=$HOME/python/Python-2.7.2/:$PATH
export PYTHONPATH=$HOME/python/lib/python2.7/site-packages:$PYTHONPATH

I'm sure that the last one is correct because when I do cd $HOME/python/lib/python2.7/site-packages, I get:

我确定最后一个是正确的,因为当我这样做时cd $HOME/python/lib/python2.7/site-packages,我得到:

./                            pip-1.4.1-py2.7.egg-info/
../                           setuptools-0.6c11-py2.7.egg-info
README                        setuptools-2.0.2-py2.7.egg/
distribute-0.6.49-py2.7.egg/  setuptools-2.0.2-py2.7.egg.OLD.1388586026.24
easy-install.pth              setuptools.pth
pip/

But then, if I try to use PIP, I get:

但是,如果我尝试使用 PIP,我会得到:

-bash: pip: command not found

回答by furins

pipexecutable is not in your PATH (it shouldbe in /usr/local/bin/pip, so you need to have /usr/local/binin your PATH or -maybe- $HOME/.local/usr/local/binaccording to your .bashrc).

pip可执行文件不在您的 PATH 中(它应该在 中/usr/local/bin/pip,因此您需要/usr/local/bin在您的 PATH 中或 - 可能 -$HOME/.local/usr/local/bin根据您的.bashrc)。