【问题标题】:Why is it "pip2" instead of "pip" after installed python with brew?为什么用brew安装python后是“pip2”而不是“pip”?
【发布时间】:2017-09-12 03:08:44
【问题描述】:

我在我的mac 10.12.3上运行brew install python,日志如下:

==> Summary
????  /usr/local/Cellar/sqlite/3.20.1: 11 files, 3.0MB
==> Installing python
==> Downloading https://homebrew.bintray.com/bottles/python-2.7.13_1.sierra.bottle.tar.gz
######################################################################## 100.0%
==> Pouring python-2.7.13_1.sierra.bottle.tar.gz
==> /usr/local/Cellar/python/2.7.13_1/bin/python2 -s setup.py --no-user-cfg install --force --verbose --single-
==> /usr/local/Cellar/python/2.7.13_1/bin/python2 -s setup.py --no-user-cfg install --force --verbose --single-
==> /usr/local/Cellar/python/2.7.13_1/bin/python2 -s setup.py --no-user-cfg install --force --verbose --single-
==> Caveats
This formula installs a python2 executable to /usr/local/bin.
If you wish to have this formula's python executable in your PATH then add
the following to ~/.bash_profile:
  export PATH="/usr/local/opt/python/libexec/bin:$PATH"

Pip and setuptools have been installed. To update them
  pip2 install --upgrade pip setuptools

You can install Python packages with
  pip2 install <package>

They will install into the site-package directory
  /usr/local/lib/python2.7/site-packages

See: https://docs.brew.sh/Homebrew-and-Python.html
==> Summary

```

正如日志所说,我们有 pip 以外的 pip2 命令。这些应该如何发生?

【问题讨论】:

  • 我不明白,你已经安装了 PIP,别名只是称为pip2,可能是为了将它与你系统上的任何 Python 3 pips 区分开来......究竟是什么您的问题/疑虑...?
  • @juanpa.arrivillaga 这可能是直观的。一般来说,install python* 似乎应该导致可用的命令python* 和pip*。

标签: python pip homebrew


【解决方案1】:

因为python2 和python3 都安装了像pip 和python 这样的可执行文件,所以 Homebrew 会安装每个后缀为2 或3 的可执行文件。

使用 Python 2 安装 pip 和使用 Python 3 安装 pip3 的问题是人们倾向于依赖默认的无后缀版本。通过此更改,Homebrew 允许您使用例如选择您想要的默认 python/pip别名或修改您的PATH。

【讨论】:

    【解决方案2】:

    因为您可以并排安装许多不同的 Python 版本(例如,我有 Python 2.7、3.4、3.5 和 3.6),所以许多工具通过附加版本号来区分自己。 pip2 与 pip3; pip2.7 与 pip3.4; wheel vs wheel-3.6 等等。

    【讨论】:

      猜你喜欢
      • 2018-06-09
      • 1970-01-01
      • 1970-01-01
      • 2016-10-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-04-01
      • 1970-01-01
      相关资源
      最近更新 更多