pip disappeared for some reason pip was fine but today when I tried to use it, I got this message:

-bash: pip: command not found


That's weird. brew shows that the python package from brew is still installed but now typing python in the terminal will run the one by default on the system instead:

~: brew install python
Warning: python 2.7.13_1 is already installed

~: python
Python 2.7.10 (default, Feb  7 2017, 00:08:15) 


Trying to import the packages I had didn't work as well:

~: python
&gt;&gt;&gt; import cv2
Traceback (most recent call last):
  File "&lt;stdin&gt;", line 1, in &lt;module&gt;
ImportError: No module named cv2
&gt;&gt;&gt; import PIL
Traceback (most recent call last):
  File "&lt;stdin&gt;", line 1, in &lt;module&gt;
ImportError: No module named PIL


If I go into /usr/local/lib/python2.7/site-packages/, everything seems fine. Strangely it also work if I type

~: pip2 -V
pip 9.0.1 from /usr/local/lib/python2.7/site-packages (python 2.7)
~: python2
Python 2.7.13 (default, Jul 18 2017, 09:17:00) 
&gt;&gt;&gt; import cv2
&gt;&gt;&gt;


What I can do to get pip (and my packages) back?
I am pretty sure that the reason these symlinks changed was due to the homebrew updates announced in version 1.3.0:


  "The most significant change since 1.2.0 is that brew install python
  no longer installs a python binary without manual PATH additions and
  instead installs a python2 binary. This avoids overriding the system
  python binary by default when installing Python as a dependency. It
  also paves the way to eventually have python be Python 3.x."