#!/usr/bin/env python3

## Update installed pip packages
## From: https://stackoverflow.com/questions/2720014/upgrading-all-packages-with-pip

import pip
from subprocess import call

for dist in pip.get_installed_distributions():
    if 'site-packages' in dist.location:
        try:
            call(['pip', 'install', '-U', dist.key])
        except Exception as exc:
            print(exc)
