Steven's Blog

A Dream Land of Peace!

Pip更新所有的包

I want to update all the installed python modules through pip. Here below is one recipe I found.

1
2
3
4
5
import pip
from subprocess import call

for dist in pip.get_installed_distributions():
    call("pip install --upgrade " + dist.project_name, shell=True)