python3-pip 已安装,但 returns "command not found"?

python3-pip installed, but returns "command not found"?

我发现还有其他一些 post 解决了我的问题,但其中 none 解决了我的问题,所以我创建了这个 post.

我正在尝试为我的 Raspberry Pi B+ 安装 rpi.gpio。我安装了 python3-pip,但每次我尝试使用 pip3 从命令行调用它时,我都会得到 "command not found"。我卸载了它:

sudo apt-get remove python3-pip

然后重新安装

sudo apt-get install python3-pip

并得到以下信息:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  python3-pip
0 upgraded, 1 newly installed, 0 to remove and 183 not upgraded.
Need to get 0 B/79.7 kB of archives.
After this operation, 361 kB of additional disk space will be used.
Selecting previously unselected package python3-pip.
(Reading database ... 70831 files and directories currently installed.)
Unpacking python3-pip (from .../python3-pip_1.1-3_all.deb) ...
Processing triggers for man-db ...
Setting up python3-pip (1.1-3) ...

但是当我尝试这样做时:

sudo pip3 install rpi.gpio

我得到:

sudo: pip3: command not found

我尝试了这个网站和其他网站的建议,看看是否安装了 pip 以及在哪里找到它,但我总是得到 "command not found":

pi@raspberrypi ~ $ locate pip3
bash: locate: command not found
pi@raspberrypi ~ $ pip --version
bash: pip: command not found
pi@raspberrypi ~ $ python3-pip --version
bash: python3-pip: command not found
pi@raspberrypi ~ $ python3.2-pip --version
bash: python3.2-pip: command not found

如何安装 pip???这让我抓狂....

如果库可用,您始终可以使用 python3 -m pip(可能与 sudo 一起使用)- 就像安装到正确的位置一样。这不依赖于将 pip 作为普通命令安装,这只是一个快捷方式。

尝试使用:

sudo python3 -m pip

sudo python -m pip

安装locate运行

sudo apt-get install mlocate

然后用

更新locatedb
sudo updatedb

这可能需要一些时间,具体取决于您计算机上的文件数量

locate 现在应该可以工作并向您显示所有 pip 的位置

回到根本问题。 在 Raspian wheezy 中,pip 由 pip-3.2 管理,您可以轻松地创建一个 pip3 别名或指向它的符号链接,以避免每次都输入 pip-3.2

pip-3.2 install rpi.gpio

有关详细信息,您可以阅读 docs 关于 python 软件包和 raspberry pi