我下载了pip并运行python setup.py install,一切正常。本教程的下一步是运行pip install <lib,你想要>,但在它尝试在线查找任何东西之前,我得到一个错误“bash: pip: command not found”。

这是在Mac OS x上,我假设在运行setup。py时,某种路径设置没有正确设置。我如何进一步调查?我需要检查什么才能更好地了解问题的确切原因?

编辑:我还尝试了为Mac安装Python 2.7,希望友好的安装过程会做一些管理工作,比如编辑PATH和任何其他需要发生的事情,以便根据教程工作,但这并不管用。安装后,运行'python'仍然运行python 2.6, PATH没有更新。


当前回答

2020年更新:

对于当前的Debian/Ubuntu,使用

apt-get install python3-pip

安装pip3。


2013年的旧答案(easy_install现在已弃用):

使用setuptools安装pip: sudo easy_install pip

(我知道我上面的回答与klobucar的回答是多余的,但我还不能添加注释),所以这里有一个解决sudo的答案:easy_install:命令在Debian/Ubuntu上找不到:sudo apt-get install python-setuptools

同样,对于python3,使用easy_install3和python3-setuptools。

对于Python 3,使用apt-get install python3-pip。

其他回答

它可能是根权限。我试着退出root登录,然后使用

sudo su -l root
pip <command>

试试这个。我们可以使用任何包来代替zmq。

sudo apt-get install python3-pip
sudo apt-get update
python3 -m pip install zmq

我无法在我的docker映像中安装这个zmq包,因为我遇到了同样的问题。所以尝试这作为另一种方式安装,它为我工作良好。

如果您运行的是Python 3.5,则执行以下终端命令:

sudo pip3 install -U nltk

终端中的任何其他pip命令都类似:

pip3 install --upgrade pip
sudo pip3 install -U numpy ::

通过升级python 3 brew upgrade python解决了这个问题: 现在我可以做:

pip3 install  <package>  

==> python
Python has been installed as
  /usr/local/bin/python3

Unversioned symlinks `python`, `python-config`, `pip` etc. pointing to
`python3`, `python3-config`, `pip3` etc., respectively, have 

我也遇到过类似的问题。我卸载了pip3,然后重新安装:

卸载:

sudo apt-get remove python3-pip

重新安装:

sudo apt-get install python3-pip

这对我来说很有用:)