How to uninstall all unused packages in a conda virtual environment?

大兔子大兔子 提交于 2020-05-09 19:35:20

问题


I have a conda virtual environment with several unused packages installed inside it (either using pip install or conda install).

What is the easiest way to clean it up so that only packages that are actually used by my code remain, and the others are uninstalled?


回答1:


conda clean --yes --all

will sanitize everything. But take note: if you ever want to do any type of --offline operations, don't use --all; be more selective.




回答2:


The difference between

    conda clean --yes --all

and

    conda clean --yes --packages

is that the packages are only the extracted folders. All of the other files (.tar.bz2, .conda, that is: tarballs) are not cleaned by --packages.

If you want to clean only the tarballs, you would need

    conda clean --yes --tarballs

References: Anaconda Python: Delete .tar.gz in pkgs



来源:https://stackoverflow.com/questions/36308531/how-to-uninstall-all-unused-packages-in-a-conda-virtual-environment

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!