# 当前pip 22.1.2
# 需要安装 setuptools
import pkg_resources
from subprocess import call
packages = [dist.project_name for dist in pkg_resources.working_set]
# 使用豆瓣源更新
call("pip install -i https://pypi.douban.com/simple/ --upgrade " + ' '.join(packages), shell=True)