pip3:找不到命令

问题描述 投票:8回答:3

我想按照此说明安装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
python tensorflow homebrew pip3
3个回答
25
投票

你需要安装pip3。

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

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


0
投票

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


0
投票

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

brew upgrade python
© www.soinside.com 2019 - 2024. All rights reserved.