它为什么" pip2"而不是" pip"安装python后用brew?

时间:2017-09-12 03:08:45

标签: python pip homebrew

我在我的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命令。这些应该怎么发生?

2 个答案:

答案 0 :(得分:5)

由于python2python3都安装了pippython等可执行文件,因此Homebrew会安装后缀为23的每个可执行文件。

使用Python 2安装pip和使用Python 3安装pip3的问题是人们倾向于依赖默认的非后缀版本。通过此更改,Homebrew可让您选择使用默认值python / pip作为默认值。别名或修改PATH

答案 1 :(得分:1)

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