【Anaconda】清理 conda 缓存后释放了几十 GB 空间

【Anaconda】清理 conda 缓存后释放了几十 GB 空间,第1张

文章目录
  • 问题背景
  • 清理命令
    • 命令参数
    • 稳妥的清理命令

问题背景

之前虚拟环境的默认目录设置在 /home/ 下,导致 /home/ 目录不堪重负,在修改了虚拟环境的默认路径之后,发现包环境目录下存在很多文件夹和解压之前的压缩包,占用了极大的空间,既然叫缓存目录,我便到网上了解了一下该目录能否删除。

清理命令 命令参数
conda clean -h
xxx@xxx-Desktop:~$ conda clean -h
usage: conda clean [-h] [-a] [-i] [-p] [-t] [-f]
                   [-c TEMPFILES [TEMPFILES ...]] [-d] [--json] [-q] [-v] [-y]

Remove unused packages and caches.

Options:

optional arguments:
  -h, --help            Show this help message and exit.

Removal Targets:
  -a, --all             Remove index cache, lock files, unused cache packages,
                        and tarballs.
  -i, --index-cache     Remove index cache.
  -p, --packages        Remove unused packages from writable package caches.
                        WARNING: This does not check for packages installed
                        using symlinks back to the package cache.
  -t, --tarballs        Remove cached package tarballs.
  -f, --force-pkgs-dirs
                        Remove *all* writable package caches. This option is
                        not included with the --all flag. WARNING: This will
                        break environments with packages installed using
                        symlinks back to the package cache.
  -c TEMPFILES [TEMPFILES ...], --tempfiles TEMPFILES [TEMPFILES ...]
                        Remove temporary files that could not be deleted
                        earlier due to being in-use. Argument is path(s) to
                        prefix(es) where files should be found and removed.

Output, Prompt, and Flow Control Options:
  -d, --dry-run         Only display what would have been done.
  --json                Report all output as json. Suitable for using conda
                        programmatically.
  -q, --quiet           Do not display progress bar.
  -v, --verbose         Can be used multiple times. Once for INFO, twice for
                        DEBUG, three times for TRACE.
  -y, --yes             Do not ask for confirmation.

Examples:

    conda clean --tarballs
稳妥的清理命令
  • conda clean -p :从可写包缓存中删除未使用的包。警告:这不会检查已安装的软件包使用符号链接返回包缓存。
  • conda clean -t:删除缓存的包 tarball。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/langs/794307.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-06
下一篇 2022-05-06

发表评论

登录后才能评论

评论列表(0条)

保存