pip install is not installing executables in /usr/local/bin

I recently setup a new Ubuntu 16.04.2 machine. I'm trying to install some python packages, but all the packages are getting installed at /usr/local/lib/python2.7.10/bin instead of /usr/bin or /usr/local/bin.

Installing collected packages: git-review

  changing mode of /usr/local/lib/python2.7.10/bin/git-review to 755
Successfully installed git-review-1.25.0

What's the problem here?


Solution 1:

Open a terminal and run:

pip uninstall git-review
sudo pip uninstall git-review
sudo pip install --prefix /usr/local git-review
git review --version

The last command should output something like git-review version 1.25.0.

Solution 2:

I had to remove the pip package that was installed by apt.

sudo apt remove python-pip

And then install pip again according to instructions on their website - https://pip.pypa.io/en/stable/installing/.

wget https://bootstrap.pypa.io/get-pip.py
sudo python get-pip.py

Looks like pip from Ubuntu's default repository is not same as one distributed by pypi.