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
,您可以改用以下命令:)
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.
(grep
将跳过@jawache建议的可编辑(“ -e”)软件包定义。)
(Yes, you could replace grep
+ cut
with sed
or awk
or perl
or...). ((是的,您可以将grep
+ cut
替换为sed
或awk
或perl
或...)。)
The -n1
flag for xargs
prevents stopping everything if updating one package fails (thanks @andsens ).
(如果更新一个软件包失败(感谢@andsens ),则xargs
的-n1
标志可阻止停止所有操作。)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…