10.24 2010-04-27 09:23 采纳率: 0%
浏览 3939
已采纳

用 pip 升级所有包

Is it possible to upgrade all Python packages at one time with pip?

Note that there is a feature request for this on the official issue tracker.

转载于:https://stackoverflow.com/questions/2720014/upgrading-all-packages-with-pip

  • 写回答

29条回答 默认 最新

  • 关注

    There isn't a built-in flag yet, but you can use

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

    Note: there are infinite potential variations for this. I'm trying to keep this answer short and simple, but please do suggest variations in the comments!

    In older version of pip, you can use this instead:

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

    The grep is to skip editable ("-e") package definitions, as suggested by @jawache. (Yes, you could replace grep+cut with sed or awk or perl or...).

    The -n1 flag for xargs prevents stopping everything if updating one package fails (thanks @andsens).

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(28条)

报告相同问题?

悬赏问题

  • ¥15 django项目运行报编码错误
  • ¥15 请问这个是什么意思?
  • ¥15 STM32驱动继电器
  • ¥15 Windows server update services
  • ¥15 关于#c语言#的问题:我现在在做一个墨水屏设计,2.9英寸的小屏怎么换4.2英寸大屏
  • ¥15 模糊pid与pid仿真结果几乎一样
  • ¥15 java的GUI的运用
  • ¥15 我想付费需要AKM公司DSP开发资料及相关开发。
  • ¥15 怎么配置广告联盟瀑布流
  • ¥15 Rstudio 保存代码闪退