How to fix pip no such option: -U

Problem:

You want to install a python library using, for example

pip -U install ansicolors

However the library does not install and you instead see the following error message:

Usage:   
  pip <command> [options]

no such option: -U

Solution

You need to put -U afterinstall:

pip install -U ansicolors