pip3:找不到命令

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了pip3:找不到命令相关的知识,希望对你有一定的参考价值。

我想按照此说明安装Tensorflow。 https://www.tensorflow.org/versions/r0.12/get_started/os_setup#pip_installation

但是当我在终端上尝试这个代码时,它会返回一个错误。

$ sudo pip3 install --upgrade $TF_BINARY_URL
sudo: pip3: command not found

所以我安装了Homebrew并试图卸载并重新安装pip-3,但是没有用。

MakotonoMacBook-ea:~ makotomiyazaki$ brew uninstall python3-pip
Error: No such keg: /usr/local/Cellar/python3-pip

MakotonoMacBook-ea:~ makotomiyazaki$ brew install python3-pip
Error: No available formula with the name "python3-pip" 
==> Searching for a previously deleted formula...
Warning: homebrew/core is shallow clone. To get complete history run:
  git -C "$(brew --repo homebrew/core)" fetch --unshallow

我该怎么办才能获得pip3?我的操作系统是macOS High Sierra,我已经安装了python 3.6.2。

编辑:我试过了

python3 -m pip

什么回来了这个。

The directory '/Users/makotomiyazaki/Library/Caches/pip/http' or its 
parent directory is not owned by the current user and the cache has 
been disabled. Please check the permissions and owner of that 
directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/makotomiyazaki/Library/Caches/pip' or its parent 
directory is not owned by the current user and caching wheels has been 
disabled. check the permissions and owner of that directory. If 
executing pip with sudo, you may want sudo's -H flag.
You must give at least one requirement to install (see "pip help 
install")

我也尝试过哪个pip3,但我不知道它是否有用......

MakotonoMacBook-ea:~ makotomiyazaki$ sudo which pip3 install --upgrade $TF_BINARY_URL
/usr/bin/install
答案

你需要安装pip3。

在Linux上,命令是:sudo apt install python3-pip 在Mac上,使用brew,首先使用brew install python3 然后brew postinstall python3

尝试调用pip3 -V以查看它是否有效。

另一答案

编写整个路径/目录,例如。 (对于Windows)C:ProgramsPythonPython36-32Scriptspip3.exe install mypackage。当我遇到pip问题时,这对我很有用。

另一答案

如果你已经安装了python(pip)你可以在mac上进行升级

brew upgrade python

以上是关于pip3:找不到命令的主要内容,如果未能解决你的问题,请参考以下文章

Ubuntu中找不到pip3命令的解决方法

Mac 找不到pip 和 pip3

学习 PyQt5。在我的代码片段中找不到错误 [关闭]

羽夏闲谈—— Kdenlive flatpak 版本解决语音识别找不到 pip3

已安装 Pip,但找不到命令 [重复]

Kotlin 在片段中找不到按钮 ID,为啥?