pip3:找不到命令

时间:2017-12-28 21:46:58

标签: python tensorflow homebrew 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

6 个答案:

答案 0 :(得分:32)

您需要安装pip3。

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

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

尝试拨打pip3 -V以查看是否有效。

答案 1 :(得分:2)

我遇到了这个问题,并按照以下步骤进行了修复 您需要使用以下命令完全卸载python3-p:

sudo apt-get --purge autoremove python3-pip

然后用以下方法树脂包装包裹:

 sudo apt install python3-pip

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

 pip3 -V

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

pip3 install NumPy

答案 2 :(得分:0)

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

答案 3 :(得分:0)

如果您已经安装了python(pip),则可以通过

在Mac上进行升级
brew upgrade python

答案 4 :(得分:0)

如果其他方法无效,请尝试以下操作:

  1. 简单安装python3
  2. brew链接--overwrite python
  3. 酿制后安装python3

答案 5 :(得分:-1)

yum install python3-pip之后,检查已安装的二进制文件的名称。例如

ll /usr/bin/pip*

在我的CentOS 7上,它被命名为pip-3而不是pip3

相关问题