是否可以使用pip一次性升级所有Python包?
注意:官方问题跟踪器上对此有一个功能请求。
是否可以使用pip一次性升级所有Python包?
注意:官方问题跟踪器上对此有一个功能请求。
当前回答
这里发布的所有解决方案都打破了依赖关系。
在此对话中,将功能直接包含到pip中,包括正确管理依赖关系:
的作者https://github.com/kdeldycke/meta-package-manager写入MPM可以模拟缺少的upgrade all命令:
mpm --pip upgrade --all
其他回答
pip list --outdated --format=freeze | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 pip install -U
cmd中的一行:
for /F "delims= " %i in ('pip list --outdated --format=legacy') do pip install -U %i
因此
管道检查
之后应该确保没有中断依赖关系。
使用pip升级程序
使用该库,您可以轻松升级所有依赖项包这些是您遵循的设置。
pip安装pip升级程序
pip升级路径/of/requirements_txt_file
交互式pip需求升级程序。因为逐包升级需求是件麻烦事。它还会更新requirements.txt文件中的版本。
相当惊人的蛋黄使这很容易。
pip install yolk3k # Don't install `yolk`, see https://github.com/cakebread/yolk/issues/35
yolk --upgrade
有关蛋黄的更多信息:https://pypi.python.org/pypi/yolk/0.4.3
它可以做很多你可能会发现有用的事情。
在蝙蝠脚本中
call pip freeze > requirements.txt
call powershell "(Get-Content requirements.txt) | ForEach-Object { $_ -replace '==', '>=' } | Set-Content requirements.txt"
call pip install -r requirements.txt --upgrade