我怎样才能“清理"一个 virtualenv? [英] How can I 'clean up' a virtualenv?
问题描述
如果我想让我的 venv 尽可能干净,我该如何清理我不需要的东西?让我举个例子...
If I want to keep my venv as clean as possible how can I clean up the stuff I don't need? Let me lay out an example...
假设我尝试了一堆新模块...
Say I try a bunch of new modules...
pip install foo
pip install bar
pip install foobar
pip install foobarfoo
而且这些模块有自己的一些要求,等等.后来我决定要使用哪个,但是我的requirements.txt中有一大堆东西,我不记得我需要什么,我不知道什么,取决于什么,等等.
and these modules have some requirements of their own, etc. later I decide on which one I want to use, but then I have a huge list of stuff in my requirement.txt and I can't remember what I need and what I don't, what depends on what, etc.
我怎样才能保持干净和精益?
How can I keep it clean and lean?
推荐答案
这个答案可能正是您所需要的.
This answer may be just what you need.
您可以安装并使用 pip-autoremove 实用程序来删除包加上未使用的依赖项.
You can install and use the pip-autoremove utility to remove a package plus unused dependencies.
# install pip-autoremove
pip install pip-autoremove
# remove "somepackage" plus its dependencies:
pip-autoremove somepackage -y
这篇关于我怎样才能“清理"一个 virtualenv?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!