删除由pip安装的所有软件包最简单的方法是什么? [英] What is the easiest way to remove all packages installed by pip?
本文介绍了删除由pip安装的所有软件包最简单的方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在修复我的一个virtualenvs - 我想将所有已安装的库重新设置为与生产相匹配的库。
I'm trying to fix up one of my virtualenvs - I'd like to reset all of the installed libraries back to the ones that match production.
是有一个快速简单的方式来做这个吗?
Is there a quick and easy way to do this with pip?
推荐答案
我发现这个代码段是一个替代解决方案。这是一个更优雅的图书馆删除,而不是重新制作virtualenv:
I've found this snippet as an alternative solution. It's a more graceful removal of libraries than remaking the virtualenv:
pip freeze | xargs pip uninstall -y
如果您有包通过VCS安装,您需要排除这些行并手动删除软件包(从以下注释中提取):
In case you have packages installed via VCS, you need to exclude those lines and remove the packages manually (elevated from the comments below):
pip freeze | grep -v "^-e" | xargs pip uninstall -y
这篇关于删除由pip安装的所有软件包最简单的方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文