Anaconda下的pkgs占用空间13G,如何安全的清理(已解决)

avatar
作者
筋斗云
阅读量:0

方法一:让Anaconda自行决定清理

执行命令

conda clean -p

我的Anaconda安装在D盘,具体位置如下。你的应该也能找到对应的位置

D:\*****\**\Anaconda3\pkgs

(base) C:\Users\Liu_J>conda clean -p WARNING: C:\Users\***\.conda\pkgs does not exist WARNING: C:\Users\***\AppData\Local\conda\conda\pkgs does not exist Cache location: D:\ProgramData\Anaconda3\pkgs Will remove the following packages: D:\*****\**\Anaconda3\pkgs -----------------------------  blas-1.0-mkl                                  16 KB ca-certificates-2022.10.11-haa95532_0        454 KB certifi-2021.5.30-py36haa95532_0             278 KB certifi-2022.9.24-py38haa95532_0             311 KB cffi-1.15.1-py38h2bbff1b_2                   801 KB cryptography-38.0.1-py38h21b164f_0           4.9 MB idna-3.3-pyhd3eb1b0_0                        289 KB idna-3.4-py38haa95532_0                      516 KB libdeflate-1.8-h2bbff1b_5                    206 KB libffi-3.4.2-hd77b12b_6                      801 KB libtiff-4.4.0-h8a3f274_2                     3.5 MB libwebp-1.2.4-h2bbff1b_0                     191 KB libwebp-base-1.2.4-h2bbff1b_0                903 KB numpy-1.22.3-py38h7a0a035_0                   80 KB numpy-1.23.4-py38h3b20f71_0                   30 KB numpy-1.26.3-py310h055cbcc_0                  33 KB numpy-base-1.23.4-py38h4da318b_0            25.9 MB openssl-1.1.1s-h2bbff1b_0                   22.3 MB pillow-9.2.0-py38hdc2b20a_1                  3.0 MB pip-21.2.2-py36haa95532_0                    9.0 MB pip-22.2.2-py38haa95532_0                   11.0 MB python-3.6.13-h3758d61_0                    59.3 MB python-3.8.15-h6244533_2                    64.4 MB pytorch-1.12.1-py3.8_cuda11.3_cudnn8_0     293.3 MB pytorch-mutex-1.0-cuda                         7 KB requests-2.27.1-pyhd3eb1b0_0                 220 KB requests-2.28.1-py38haa95532_0               396 KB setuptools-58.0.4-py36haa95532_0             4.1 MB setuptools-65.5.0-py38haa95532_0             6.3 MB sqlite-3.40.0-h2bbff1b_0                     3.8 MB torchaudio-0.12.1-py38_cu113                 9.2 MB torchvision-0.13.1-py38_cu113               15.7 MB typing_extensions-4.3.0-py38haa95532_0       181 KB urllib3-1.26.12-py38haa95532_0               761 KB vc-14.2-h21ff451_1                            23 KB wincertstore-0.2-py36h7fe50ca_0               39 KB xz-5.2.6-h8cc25b3_0                          1.1 MB  --------------------------------------------------- Total:                                     543.2 MB  Proceed ([y]/n)? y  removing blas-1.0-mkl removing ca-certificates-2022.10.11-haa95532_0 removing certifi-2021.5.30-py36haa95532_0 removing certifi-2022.9.24-py38haa95532_0 removing cffi-1.15.1-py38h2bbff1b_2 removing cryptography-38.0.1-py38h21b164f_0 removing idna-3.3-pyhd3eb1b0_0 removing idna-3.4-py38haa95532_0 removing libdeflate-1.8-h2bbff1b_5 removing libffi-3.4.2-hd77b12b_6 removing libtiff-4.4.0-h8a3f274_2 removing libwebp-1.2.4-h2bbff1b_0 removing libwebp-base-1.2.4-h2bbff1b_0 removing numpy-1.22.3-py38h7a0a035_0 removing numpy-1.23.4-py38h3b20f71_0 removing numpy-1.26.3-py310h055cbcc_0 removing numpy-base-1.23.4-py38h4da318b_0 removing openssl-1.1.1s-h2bbff1b_0 removing pillow-9.2.0-py38hdc2b20a_1 removing pip-21.2.2-py36haa95532_0 removing pip-22.2.2-py38haa95532_0 removing python-3.6.13-h3758d61_0 removing python-3.8.15-h6244533_2 removing pytorch-1.12.1-py3.8_cuda11.3_cudnn8_0 removing pytorch-mutex-1.0-cuda removing requests-2.27.1-pyhd3eb1b0_0 removing requests-2.28.1-py38haa95532_0 removing setuptools-58.0.4-py36haa95532_0 removing setuptools-65.5.0-py38haa95532_0 removing sqlite-3.40.0-h2bbff1b_0 removing torchaudio-0.12.1-py38_cu113 removing torchvision-0.13.1-py38_cu113 removing typing_extensions-4.3.0-py38haa95532_0 removing urllib3-1.26.12-py38haa95532_0 removing vc-14.2-h21ff451_1 removing wincertstore-0.2-py36h7fe50ca_0 removing xz-5.2.6-h8cc25b3_0

方法二:安全的删除pkgs全部的包

这个主要清理缓存包,不会直接影响已经创建的虚拟环境

命令如下:

conda clean --all

(base) C:\Us***\****>conda clean --all Cache location: D:\ProgramData\Anaconda3\pkgs Will remove the following tarballs:  D:\*****\**\Anaconda3\pkgs ----------------------------- blas-1.0-mkl.conda                             6 KB brotli-python-1.0.9-py310hd77b12b_7.conda     309 KB brotlipy-0.7.0-py38h2bbff1b_1003.conda       412 KB bzip2-1.0.8-he774522_0.conda                 113 KB ca-certificates-2022.10.11-haa95532_0.conda     125 KB ca-certificates-2022.4.26-haa95532_0.conda     124 KB ca-certificates-2023.12.12-haa95532_0.conda     127 KB certifi-2021.5.30-py36haa95532_0.conda       140 KB certifi-2022.5.18.1-py38haa95532_0.conda     157 KB certifi-2022.9.24-py38haa95532_0.conda       154 KB certifi-2023.11.17-py310haa95532_0.conda     159 KB cffi-1.15.0-py38h2bbff1b_1.conda             223 KB cffi-1.15.1-py38h2bbff1b_2.conda             235 KB cffi-1.16.0-py310h2bbff1b_0.conda            244 KB charset-normalizer-2.0.4-pyhd3eb1b0_0.conda      35 KB cryptography-37.0.1-py38h21b164f_0.conda     979 KB cryptography-38.0.1-py38h21b164f_0.conda     992 KB cryptography-41.0.3-py310h3438e0d_0.conda     1.1 MB cudatoolkit-11.3.1-h59b6b97_2.conda        545.3 MB freetype-2.10.4-hd328e21_0.conda             466 KB freetype-2.12.1-ha860e81_0.conda             490 KB giflib-5.2.1-h8cc25b3_3.conda                 88 KB idna-3.3-pyhd3eb1b0_0.conda                   49 KB idna-3.4-py310haa95532_0.conda                97 KB idna-3.4-py38haa95532_0.conda                 94 KB intel-openmp-2021.4.0-haa95532_3556.conda     2.2 MB intel-openmp-2023.1.0-h59b6b97_46320.conda     2.7 MB jpeg-9e-h2bbff1b_0.conda                     292 KB jpeg-9e-h2bbff1b_1.conda                     320 KB lerc-3.0-hd77b12b_0.conda                    120 KB libdeflate-1.17-h2bbff1b_1.conda             153 KB libdeflate-1.8-h2bbff1b_5.conda               46 KB libffi-3.4.2-hd77b12b_6.conda                109 KB libffi-3.4.4-hd77b12b_0.conda                113 KB libpng-1.6.37-h2a8f88b_0.conda               333 KB libpng-1.6.39-h8cc25b3_0.conda               369 KB libtiff-4.2.0-he0120a3_1.conda               754 KB libtiff-4.4.0-h8a3f274_2.conda               837 KB libtiff-4.5.1-hd77b12b_0.conda               1.1 MB libuv-1.40.0-he774522_0.conda                255 KB libuv-1.44.2-h2bbff1b_0.conda                288 KB libwebp-1.2.2-h2bbff1b_0.conda               658 KB libwebp-1.2.4-h2bbff1b_0.conda                67 KB libwebp-1.3.2-hbc33d0d_0.conda                73 KB libwebp-base-1.2.4-h2bbff1b_0.conda          279 KB libwebp-base-1.3.2-h2bbff1b_0.conda          306 KB lz4-c-1.9.3-h2bbff1b_1.conda                 132 KB lz4-c-1.9.4-h2bbff1b_0.conda                 143 KB mkl-2021.4.0-haa95532_640.conda            114.9 MB mkl-2023.1.0-h6b88ed4_46358.conda          155.9 MB mkl-service-2.4.0-py310h2bbff1b_1.conda       44 KB mkl-service-2.4.0-py38h2bbff1b_0.conda        51 KB mkl_fft-1.3.1-py38h277e83a_0.conda           139 KB mkl_fft-1.3.8-py310h2bbff1b_0.conda          170 KB mkl_random-1.2.2-py38hf11a4ad_0.conda        225 KB mkl_random-1.2.4-py310h59b6b97_0.conda       227 KB numpy-1.22.3-py38h7a0a035_0.conda             25 KB numpy-1.23.4-py38h3b20f71_0.conda             11 KB numpy-1.26.3-py310h055cbcc_0.conda            11 KB numpy-base-1.22.3-py38hca35cd5_0.conda       4.9 MB numpy-base-1.23.4-py38h4da318b_0.conda       6.0 MB numpy-base-1.26.3-py310h65a83cf_0.conda      6.2 MB openjpeg-2.4.0-h4fc8c34_0.conda              219 KB openssl-1.1.1o-h2bbff1b_0.conda              4.8 MB openssl-1.1.1s-h2bbff1b_0.conda              5.5 MB openssl-1.1.1w-h2bbff1b_0.conda              5.5 MB pillow-10.0.1-py310h045eedc_0.conda          788 KB pillow-9.0.1-py38hdc2b20a_0.conda            923 KB pillow-9.2.0-py38hdc2b20a_1.conda            922 KB pip-21.2.2-py36haa95532_0.conda              1.9 MB pip-21.2.2-py38haa95532_0.conda              1.9 MB pip-22.2.2-py38haa95532_0.conda              2.3 MB pip-23.3.1-py310haa95532_0.conda             2.9 MB pycparser-2.21-pyhd3eb1b0_0.conda             94 KB pyopenssl-22.0.0-pyhd3eb1b0_0.conda           50 KB pyopenssl-23.2.0-py310haa95532_0.conda        97 KB pysocks-1.7.1-py310haa95532_0.conda           28 KB pysocks-1.7.1-py38haa95532_0.conda            31 KB python-3.10.0-h96c0403_3.tar.bz2            15.3 MB python-3.6.13-h3758d61_0.conda              14.6 MB python-3.8.13-h6244533_0.conda              16.5 MB python-3.8.15-h6244533_2.conda              18.9 MB pytorch-1.11.0-py3.8_cuda11.3_cudnn8_0.tar.bz2    1.23 GB pytorch-1.12.1-py3.10_cuda11.3_cudnn8_0.tar.bz2    1.20 GB pytorch-1.12.1-py3.8_cuda11.3_cudnn8_0.tar.bz2    1.19 GB pytorch-mutex-1.0-cuda.tar.bz2                 3 KB requests-2.27.1-pyhd3eb1b0_0.conda            54 KB requests-2.28.1-py38haa95532_0.conda         100 KB requests-2.31.0-py310haa95532_0.conda        100 KB setuptools-58.0.4-py36haa95532_0.conda       776 KB setuptools-61.2.0-py38haa95532_0.conda       1.0 MB setuptools-65.5.0-py38haa95532_0.conda       1.1 MB setuptools-68.2.2-py310haa95532_0.conda      942 KB six-1.16.0-pyhd3eb1b0_1.conda                 18 KB sqlite-3.38.3-h2bbff1b_0.conda               806 KB sqlite-3.40.0-h2bbff1b_0.conda               891 KB sqlite-3.41.2-h2bbff1b_0.conda               894 KB tbb-2021.8.0-h59b6b97_0.conda                149 KB tk-8.6.12-h2bbff1b_0.conda                   3.1 MB torchaudio-0.12.1-py310_cu113.tar.bz2        3.7 MB torchaudio-0.12.1-py38_cu113.tar.bz2         3.7 MB torchvision-0.12.0-py38_cu113.tar.bz2        9.0 MB torchvision-0.13.1-py310_cu113.tar.bz2       7.4 MB torchvision-0.13.1-py38_cu113.tar.bz2        7.4 MB typing_extensions-4.1.1-pyh06a4308_0.conda      28 KB typing_extensions-4.3.0-py38haa95532_0.conda      42 KB typing_extensions-4.9.0-py310haa95532_1.conda      55 KB tzdata-2023d-h04d1e81_0.conda                117 KB urllib3-1.26.12-py38haa95532_0.conda         185 KB urllib3-1.26.18-py310haa95532_0.conda        200 KB urllib3-1.26.9-py38haa95532_0.conda          187 KB vc-14.2-h21ff451_1.conda                       8 KB vs2015_runtime-14.27.29016-h5e58377_2.conda    1007 KB wheel-0.37.1-pyhd3eb1b0_0.conda               33 KB wheel-0.41.2-py310haa95532_0.conda           127 KB wincertstore-0.2-py36h7fe50ca_0.conda         14 KB wincertstore-0.2-py38haa95532_2.conda         15 KB win_inet_pton-1.1.0-py310haa95532_0.conda       9 KB win_inet_pton-1.1.0-py38haa95532_0.conda      35 KB xz-5.2.5-h8cc25b3_1.conda                    246 KB xz-5.2.6-h8cc25b3_0.conda                    240 KB xz-5.4.5-h8cc25b3_0.conda                    593 KB zlib-1.2.12-h8cc25b3_2.conda                 116 KB zlib-1.2.13-h8cc25b3_0.conda                 113 KB zstd-1.5.2-h19a0ad4_0.conda                  509 KB zstd-1.5.5-hd43e919_0.conda                  682 KB  --------------------------------------------------- Total:                                      4.59 GB  Proceed ([y]/n)?

这里可以清楚 4.59G

附上 conda clean 命令大全

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 

最后  pkgs的大小从13G--》8.5G

虽然搜身   但是还是很大

广告一刻

为您即时展示最新活动产品广告消息,让您随时掌握产品活动新动态!