Skip to content

Instantly share code, notes, and snippets.

@gise88
Last active May 10, 2016 22:56
Show Gist options
  • Save gise88/edf75c071c83dd2e40d00e600d8e1d87 to your computer and use it in GitHub Desktop.
Save gise88/edf75c071c83dd2e40d00e600d8e1d87 to your computer and use it in GitHub Desktop.
Upgrade all packages with pip
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import pip
from subprocess import call
euid = os.geteuid()
if euid != 0:
raise EnvironmentError("need to be root")
exit(1)
# Thanks to: http://stackoverflow.com/a/5839291
for dist in pip.get_installed_distributions():
call("pip install --upgrade " + dist.project_name, shell=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment