【Python】一键升级所有库

【Python】一键升级所有库,第1张

# -*- coding: utf-8 -*-
'''
List Packages in a Console with Pip:
	https://www.activestate.com/resources/quick-reads/how-to-list-installed-python-packages/
	https://pip.pypa.io/en/stable/user_guide/
'''

import pkg_resources, subprocess

installedPackage_WorkingSet = pkg_resources.working_set # pkg_resources.WorkingSet
installedPackage_list = sorted(['%s' % i.key for i in installedPackage_WorkingSet])

for installedPackage in installedPackage_list:
	subprocess.run('py -m pip install -i https://pypi.tuna.tsinghua.edu.cn/simple -U {}'.format(installedPackage), shell=True)

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/langs/788519.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-05
下一篇 2022-05-05

发表评论

登录后才能评论

评论列表(0条)

保存