pip3:找不到命令

Mak*_*aki 14 python homebrew tensorflow 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
Run Code Online (Sandbox Code Playgroud)

所以我安装了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
Run Code Online (Sandbox Code Playgroud)

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

编辑:我试过了

python3 -m pip
Run Code Online (Sandbox Code Playgroud)

什么回来了这个.

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")
Run Code Online (Sandbox Code Playgroud)

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

MakotonoMacBook-ea:~ makotomiyazaki$ sudo which pip3 install --upgrade $TF_BINARY_URL
/usr/bin/install
Run Code Online (Sandbox Code Playgroud)

Ali*_*ari 51

你需要安装pip3.

在Linux上,命令将是:sudo apt install python3-pip

在Mac上,使用brew,首先brew install python3
然后brew postinstall python3

试着打电话pip3 -V看它是否有效.

  • 我需要的是“ brew postinstall python3” (2认同)

Mus*_*nde 11

我遇到了这个问题,我使用以下步骤修复了它您需要使用以下方法完全卸载 python3-pip:

sudo apt-get --purge autoremove python3-pip
Run Code Online (Sandbox Code Playgroud)

然后使用以下命令重新安装包装:

 sudo apt install python3-pip
Run Code Online (Sandbox Code Playgroud)

要确认一切正常,请运行:

 pip3 -V
Run Code Online (Sandbox Code Playgroud)

在此之后,您现在可以使用 pip3 来管理您感兴趣的任何 python 包。例如

pip3 install NumPy
Run Code Online (Sandbox Code Playgroud)

  • 重新安装mysql服务器后,我出现了这个问题。以上,解决了。 (2认同)
  • 谢谢,这个答案确实很有帮助。我有同样的问题。 (2认同)