其他分享
首页 > 其他分享> > 利用pip批量升级packages

利用pip批量升级packages

作者:互联网

#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import pip
from pip._internal.utils.misc import get_installed_distributions
from subprocess import call

for dist in get_installed_distributions():
    print(dist)
    if not 'pip' in str(dist):
        call('pip3 install --upgrade %s -i https://pypi.tuna.tsinghua.edu.cn/simple' % dist.project_name, shell=True)

 

标签:dist,批量,get,call,pip,import,packages,distributions
来源: https://www.cnblogs.com/wangzhehong1981/p/11701087.html