如何一键升级 python 所有包
在日常python环境中升级python包的时候我们需要一个一个的通过以下命令去升级 比较耗时耗力
pip install * # *代表包名
# -*- coding: utf-8 -*- # @time: :2020-01-09 14:39 # @Author: GQH # @Email: [email protected] import pip from subprocess import call from pip._internal.utils.misc import get_installed_distributions if __name__ == '__main__': for dist in get_installed_distributions(): call("pip install --upgrade " + dist.project_name, shell=True)