繁体   English   中英

pip3:找不到命令

[英]pip3: command not found

我想按照这个说明安装 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")

我也尝试了 which 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以查看它是否有效。

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

sudo apt-get --purge autoremove python3-pip

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

 sudo apt install python3-pip

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

 pip3 -V

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

pip3 install NumPy

如果您已经安装了python(pip),则可以通过以下方式在mac上进行升级

brew upgrade python

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

如果其他方法不起作用,请尝试此操作:

  1. 酿造安装python3
  2. 酿造链接--覆盖python
  3. 酿造后安装python3

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

ll /usr/bin/pip*

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

就我而言,虽然已经安装了 python3-pip,但它无法识别 pip3。 重新安装后

sudo yum reinstall python3-pip

它工作正常并且可以识别 pip3 命令。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM