Last active
May 10, 2016 22:56
-
-
Save gise88/edf75c071c83dd2e40d00e600d8e1d87 to your computer and use it in GitHub Desktop.
Upgrade all packages with pip
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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