Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 708
heLomaN Avatar asked Sep 12 '17 03:09

heLomaN


People also ask

Why is pip not installed with Python?

The Pip Install is Not in the System Variable For Python commands to run from a Windows Command Prompt, the path of your pip install will need to be added to your PATH system variable. It should be added automatically if you installed Python via the installation file.

What is pip2 in Python?

DESCRIPTION. pip is a Python package installer, recommended for installing Python packages which are not available in the Debian archive.

Why do I have pip3 but not pip?

pip3 is an updated version of pip which is used basically for python 3+. The system will use one of your Python versions depending on what exactly is first in the system PATH variable. When you run PIP3, you can be sure that the module will be installed in Python 3.


Video Answer


2 Answers

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 e.g. aliases or modifying your PATH.

like image 192
bfontaine Avatar answered Oct 10 '22 09:10

bfontaine


As you can install many different Python versions side by side (I have Python 2.7, 3.4, 3.5 and 3.6, e.g.) many tools distinguish themselves by appending version numbers. pip2 vs pip3; pip2.7 vs pip3.4; wheel vs wheel-3.6 and so on.

like image 32
phd Avatar answered Oct 10 '22 07:10

phd