Skip to content

Instantly share code, notes, and snippets.

@nolram
Last active December 16, 2015 16:36
Show Gist options
  • Save nolram/fd3850aad53cd7d0a3e9 to your computer and use it in GitHub Desktop.
Save nolram/fd3850aad53cd7d0a3e9 to your computer and use it in GitHub Desktop.
Atualização de todos os pacotes pip de Python 3.4
def update_all_pip(exceptions=[]):
'''
Esse método atualiza todos os pacotes instalados através do método call()
@arg: exceptions é uma lista de nomes de pacotes em caixa baixa que não serão atualizados
'''
to_update = pip.get_installed_distributions(skip=["setuptools", "python", "pip",
"distribute"]+exceptions)
for dist in range(0, len(to_update)):
print("Verificando o pacote %s - restando: %s de %s " % (to_update[dist], dist+1, len(to_update)))
call("pip install --upgrade "+ to_update[dist].project_name, shell=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment