跳转到内容
Go back

更新全部 Python 包

更新于:

更新全部 Python 包

在 Windows 环境下,可以通过在 Windows PowerShell 中使用 pip 来更新所有 python 包:

pip freeze | %{$_.split('==')[0]} | %{pip install --upgrade $_}

Linux 提供了多种使用 pip 升级 Python 包的方法,包括 grep 和 awk:

方式 1:使用 grep 通过 pip 升级所有包

pip3 list --outdated --format=freeze | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 pip3 install -U 

方式 2:使用 pip 和 awk 升级所有包

pip3 list -o | cut -f1 -d' ' | tr " " "\n" | awk '{if(NR>=3)print}' | cut -d' ' -f1 | xargs -n1 pip3 install -U 

附录

参考资料


分享文章至:

Previous Post
怎样当好一名师长
Next Post
GitHub Actions 打包 Tinytex 环境报错记录