本文介绍了在代码中升级python模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的问题与此问题有关:在代码内安装python模块,但涉及升级模块.

My question relates to this question: Installing python module within code, but involves upgrading the module.

我尝试过

packages=['apscheduler','beautifulsoup4','gdata']

def upgrade(packages):
    for package in packages:
        pip.main(['install --upgrade', package])

def upgrade(packages):
    for package in packages:
        pip.main(['install', package + ' --upgrade'])

推荐答案

尝试pip.main(['install', '--upgrade', package]).

-upgrade"是一个单独的命令行参数,因此您需要将其分别传递给main.

"--upgrade" is a separate command-line argument, so you need to pass it separately to main.

这篇关于在代码中升级python模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-14 07:01