简体   繁体   English

在使用brew安装python后,为什么它是“pip2”而不是“pip”?

[英]Why is it “pip2” instead of “pip” after installed python with brew?

I ran brew install python on my mac 10.12.3, and the logs are as following: 我在我的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

``` ```

As the log said, we have the pip2 command other than pip. 正如日志所说,除了pip之外,我们还有pip2命令。 How should these happen? 这些应该怎么发生?

Because both python2 and python3 install executables like pip and python , Homebrew installs each executable suffixed with either 2 or 3 . 因为python2python3安装了像pippython这样的可执行文件,所以Homebrew会安装每个后缀为23可执行文件。

The problem with installing pip with Python 2 and pip3 with Python 3 is people tend to rely on the default, non-suffixed version. 使用Python 2安装pip和使用Python 3安装pip3的问题是人们倾向于依赖默认的非后缀版本。 With this change, Homebrew lets you choose which you want to have as a default python / pip using eg aliases or modifying your PATH . 通过此更改,Homebrew允许您使用例如别名或修改PATH来选择您想要的默认python / pip

As you can install many different Python versions side by side (I have Python 2.7, 3.4, 3.5 and 3.6, eg) many tools distinguish themselves by appending version numbers. 由于您可以并排安装许多不同的Python版本(我有Python 2.7,3.4,3.5和3.6等),许多工具通过附加版本号来区分自己。 pip2 vs pip3 ; pip2 vs pip3 ; pip2.7 vs pip3.4 ; pip2.7 vs pip3.4 ; wheel vs wheel-3.6 and so on. wheelwheel-3.6等。

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

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