简体   繁体   中英

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:

==> 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. 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 .

The problem with installing pip with Python 2 and pip3 with Python 3 is people tend to rely on the default, non-suffixed version. With this change, Homebrew lets you choose which you want to have as a default python / pip using eg aliases or modifying your PATH .

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. pip2 vs pip3 ; pip2.7 vs pip3.4 ; wheel vs wheel-3.6 and so on.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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