Python一键升级所有库---Python3.6版本亲测请用

网上搜到的大部分是这个版本

import pip
from subprocess import call

for dist in pip.get_installed_distributions():
    call("pip install --upgrade " + dist.project_name, shell=True)

使用时会提示pip中没有这个函数get_installed_distributions()

更新如下

#!/usr/bin/env python
# encoding: utf-8

import pip
from subprocess import call
from pip._internal.utils.misc import get_installed_distributions
for dist in get_installed_distributions():
    call("pip install --upgrade " + dist.project_name, shell=True)

猜你喜欢

转载自blog.csdn.net/samenmoer/article/details/82502986