批量更新python库
1 import pip 2 from subprocess import call 3 4 for dist in pip.get_installed_distributions(): 5 try: 6 call("pip install --upgrade " + dist.project_name, shell=True) 7 except Exception as e: 8 print(e)
雁驰万里却作禽,鱼未得水空有鳞。 花开花落花不语,昨是昨非昨亦今。
1 import pip 2 from subprocess import call 3 4 for dist in pip.get_installed_distributions(): 5 try: 6 call("pip install --upgrade " + dist.project_name, shell=True) 7 except Exception as e: 8 print(e)