Skip to content

Instantly share code, notes, and snippets.

@wangjiezhe
Last active February 10, 2024 03:22
Show Gist options
  • Save wangjiezhe/23a96ea905be1f47108231d33475cf13 to your computer and use it in GitHub Desktop.
Save wangjiezhe/23a96ea905be1f47108231d33475cf13 to your computer and use it in GitHub Desktop.
更新全部 python 包

列举所有需要升级的包:

pip list --outdated

在 Windows 上更新:

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

在 Linux 上更新:

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

或者

pip list -lo | cut -f1 -d' ' | tr " " "\n" | awk '{if(NR>=3)print}' | cut -d' ' -f1 | xargs -n1 pip install -U
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment