我找不到任何命令来卸载和删除所有 PyTorch 依赖项。甚至在pytorch.org网站上。
我安装了 PyTorch
conda install pytorch torchvision cuda80 -c soumith
我找不到任何命令来卸载和删除所有 PyTorch 依赖项。甚至在pytorch.org网站上。
我安装了 PyTorch
conda install pytorch torchvision cuda80 -c soumith
从anaconda docs,您可以卸载conda uninstall
尝试
conda uninstall pytorch torchvision cuda80 -c soumith
或者,pytorch 文档建议
conda uninstall pytorch
pip uninstall torch
pip uninstall torch # run this command twice
这是根据pytorch github repo中的CONTRIBUTING.md的正确命令集:
卸载所有现有的 pytorch 安装
conda uninstall pytorch
pip uninstall torch
pip uninstall torch # run this command twice
你也可以使用
conda remove torch torchvision
请注意,这将删除指定的包(此处为:torch 和 torchvision)以及任何其他依赖于torch 和 torchvision的包(如果有的话)。
PSconda uninstall
是conda remove
.
也许@Schütze 的意思是“这不会删除所有文件”。Anaconda\pkgs 文件夹中仍有文件。
请注意,您可以删除 tar.b2 和 Anaconda\pkgs 中现在未使用的软件包的文件夹。我卸载了 pytorch cuda 版本(因为我的显示驱动程序不支持 cuda)并且那里有巨大的文件:
这总共有 3 GB!手动执行此操作,或使用命令:
删除所有不需要的包:
conda clean --yes --packages --dry-run
删除所有不需要的 tar.bz2 / conda
conda clean --yes --tarballs --dry-run
一起删除
conda clean --yes --all --dry-run
首先使用参数 --dry-run 看看会发生什么。之后,在没有 --dry-run 的情况下运行。这已经清理了 Anaconda\pkgs 使用的 7 GB 磁盘空间中的大约 3.5 GB。
参考: 如何在 conda 虚拟环境中卸载所有未使用的包?和 Anaconda Python:删除 pkgs 中的 .tar.gz
您可以使用以下 conda 命令安全地删除 pytorch 安装:
conda uninstall pytorch-cpu torchvision-cpu pytorch
我最近发现了一个好工具!
pip install pip-autoremove
这个工具可以删除你需要删除的所有工具。例如,如果你需要删除torch,那么它也可以删除torchvision!
Usage: pip-autoremove [OPTION]... [NAME]...
Options:
--version show program's version number and exit
-h, --help show this help message and exit
-l, --list list unused dependencies, but don't uninstall them.
-L, --leaves list leaves (packages which are not used by any others).
-y, --yes don't ask for confirmation of uninstall deletions.