pip升级所有python包import pipfrom subprocess import callfor dist in pip.get_installed_distributions(): call("pip install --upgrade " + dist.project_name, shell=True)print('ok')注:此脚本并非原创,只是为了以后查找方便。