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


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

    执行命令

    conda clean -p

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

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

    1. (base) C:\Users\Liu_J>conda clean -p
    2. WARNING: C:\Users\***\.conda\pkgs does not exist
    3. WARNING: C:\Users\***\AppData\Local\conda\conda\pkgs does not exist
    4. Cache location: D:\ProgramData\Anaconda3\pkgs
    5. Will remove the following packages:
    6. D:\*****\**\Anaconda3\pkgs
    7. -----------------------------
    8. blas-1.0-mkl 16 KB
    9. ca-certificates-2022.10.11-haa95532_0 454 KB
    10. certifi-2021.5.30-py36haa95532_0 278 KB
    11. certifi-2022.9.24-py38haa95532_0 311 KB
    12. cffi-1.15.1-py38h2bbff1b_2 801 KB
    13. cryptography-38.0.1-py38h21b164f_0 4.9 MB
    14. idna-3.3-pyhd3eb1b0_0 289 KB
    15. idna-3.4-py38haa95532_0 516 KB
    16. libdeflate-1.8-h2bbff1b_5 206 KB
    17. libffi-3.4.2-hd77b12b_6 801 KB
    18. libtiff-4.4.0-h8a3f274_2 3.5 MB
    19. libwebp-1.2.4-h2bbff1b_0 191 KB
    20. libwebp-base-1.2.4-h2bbff1b_0 903 KB
    21. numpy-1.22.3-py38h7a0a035_0 80 KB
    22. numpy-1.23.4-py38h3b20f71_0 30 KB
    23. numpy-1.26.3-py310h055cbcc_0 33 KB
    24. numpy-base-1.23.4-py38h4da318b_0 25.9 MB
    25. openssl-1.1.1s-h2bbff1b_0 22.3 MB
    26. pillow-9.2.0-py38hdc2b20a_1 3.0 MB
    27. pip-21.2.2-py36haa95532_0 9.0 MB
    28. pip-22.2.2-py38haa95532_0 11.0 MB
    29. python-3.6.13-h3758d61_0 59.3 MB
    30. python-3.8.15-h6244533_2 64.4 MB
    31. pytorch-1.12.1-py3.8_cuda11.3_cudnn8_0 293.3 MB
    32. pytorch-mutex-1.0-cuda 7 KB
    33. requests-2.27.1-pyhd3eb1b0_0 220 KB
    34. requests-2.28.1-py38haa95532_0 396 KB
    35. setuptools-58.0.4-py36haa95532_0 4.1 MB
    36. setuptools-65.5.0-py38haa95532_0 6.3 MB
    37. sqlite-3.40.0-h2bbff1b_0 3.8 MB
    38. torchaudio-0.12.1-py38_cu113 9.2 MB
    39. torchvision-0.13.1-py38_cu113 15.7 MB
    40. typing_extensions-4.3.0-py38haa95532_0 181 KB
    41. urllib3-1.26.12-py38haa95532_0 761 KB
    42. vc-14.2-h21ff451_1 23 KB
    43. wincertstore-0.2-py36h7fe50ca_0 39 KB
    44. xz-5.2.6-h8cc25b3_0 1.1 MB
    45. ---------------------------------------------------
    46. Total: 543.2 MB
    47. Proceed ([y]/n)? y
    48. removing blas-1.0-mkl
    49. removing ca-certificates-2022.10.11-haa95532_0
    50. removing certifi-2021.5.30-py36haa95532_0
    51. removing certifi-2022.9.24-py38haa95532_0
    52. removing cffi-1.15.1-py38h2bbff1b_2
    53. removing cryptography-38.0.1-py38h21b164f_0
    54. removing idna-3.3-pyhd3eb1b0_0
    55. removing idna-3.4-py38haa95532_0
    56. removing libdeflate-1.8-h2bbff1b_5
    57. removing libffi-3.4.2-hd77b12b_6
    58. removing libtiff-4.4.0-h8a3f274_2
    59. removing libwebp-1.2.4-h2bbff1b_0
    60. removing libwebp-base-1.2.4-h2bbff1b_0
    61. removing numpy-1.22.3-py38h7a0a035_0
    62. removing numpy-1.23.4-py38h3b20f71_0
    63. removing numpy-1.26.3-py310h055cbcc_0
    64. removing numpy-base-1.23.4-py38h4da318b_0
    65. removing openssl-1.1.1s-h2bbff1b_0
    66. removing pillow-9.2.0-py38hdc2b20a_1
    67. removing pip-21.2.2-py36haa95532_0
    68. removing pip-22.2.2-py38haa95532_0
    69. removing python-3.6.13-h3758d61_0
    70. removing python-3.8.15-h6244533_2
    71. removing pytorch-1.12.1-py3.8_cuda11.3_cudnn8_0
    72. removing pytorch-mutex-1.0-cuda
    73. removing requests-2.27.1-pyhd3eb1b0_0
    74. removing requests-2.28.1-py38haa95532_0
    75. removing setuptools-58.0.4-py36haa95532_0
    76. removing setuptools-65.5.0-py38haa95532_0
    77. removing sqlite-3.40.0-h2bbff1b_0
    78. removing torchaudio-0.12.1-py38_cu113
    79. removing torchvision-0.13.1-py38_cu113
    80. removing typing_extensions-4.3.0-py38haa95532_0
    81. removing urllib3-1.26.12-py38haa95532_0
    82. removing vc-14.2-h21ff451_1
    83. removing wincertstore-0.2-py36h7fe50ca_0
    84. removing xz-5.2.6-h8cc25b3_0

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

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

    命令如下:

    conda clean --all

    1. (base) C:\Us***\****>conda clean --all
    2. Cache location: D:\ProgramData\Anaconda3\pkgs
    3. Will remove the following tarballs:
    4. D:\*****\**\Anaconda3\pkgs
    5. -----------------------------
    6. blas-1.0-mkl.conda 6 KB
    7. brotli-python-1.0.9-py310hd77b12b_7.conda 309 KB
    8. brotlipy-0.7.0-py38h2bbff1b_1003.conda 412 KB
    9. bzip2-1.0.8-he774522_0.conda 113 KB
    10. ca-certificates-2022.10.11-haa95532_0.conda 125 KB
    11. ca-certificates-2022.4.26-haa95532_0.conda 124 KB
    12. ca-certificates-2023.12.12-haa95532_0.conda 127 KB
    13. certifi-2021.5.30-py36haa95532_0.conda 140 KB
    14. certifi-2022.5.18.1-py38haa95532_0.conda 157 KB
    15. certifi-2022.9.24-py38haa95532_0.conda 154 KB
    16. certifi-2023.11.17-py310haa95532_0.conda 159 KB
    17. cffi-1.15.0-py38h2bbff1b_1.conda 223 KB
    18. cffi-1.15.1-py38h2bbff1b_2.conda 235 KB
    19. cffi-1.16.0-py310h2bbff1b_0.conda 244 KB
    20. charset-normalizer-2.0.4-pyhd3eb1b0_0.conda 35 KB
    21. cryptography-37.0.1-py38h21b164f_0.conda 979 KB
    22. cryptography-38.0.1-py38h21b164f_0.conda 992 KB
    23. cryptography-41.0.3-py310h3438e0d_0.conda 1.1 MB
    24. cudatoolkit-11.3.1-h59b6b97_2.conda 545.3 MB
    25. freetype-2.10.4-hd328e21_0.conda 466 KB
    26. freetype-2.12.1-ha860e81_0.conda 490 KB
    27. giflib-5.2.1-h8cc25b3_3.conda 88 KB
    28. idna-3.3-pyhd3eb1b0_0.conda 49 KB
    29. idna-3.4-py310haa95532_0.conda 97 KB
    30. idna-3.4-py38haa95532_0.conda 94 KB
    31. intel-openmp-2021.4.0-haa95532_3556.conda 2.2 MB
    32. intel-openmp-2023.1.0-h59b6b97_46320.conda 2.7 MB
    33. jpeg-9e-h2bbff1b_0.conda 292 KB
    34. jpeg-9e-h2bbff1b_1.conda 320 KB
    35. lerc-3.0-hd77b12b_0.conda 120 KB
    36. libdeflate-1.17-h2bbff1b_1.conda 153 KB
    37. libdeflate-1.8-h2bbff1b_5.conda 46 KB
    38. libffi-3.4.2-hd77b12b_6.conda 109 KB
    39. libffi-3.4.4-hd77b12b_0.conda 113 KB
    40. libpng-1.6.37-h2a8f88b_0.conda 333 KB
    41. libpng-1.6.39-h8cc25b3_0.conda 369 KB
    42. libtiff-4.2.0-he0120a3_1.conda 754 KB
    43. libtiff-4.4.0-h8a3f274_2.conda 837 KB
    44. libtiff-4.5.1-hd77b12b_0.conda 1.1 MB
    45. libuv-1.40.0-he774522_0.conda 255 KB
    46. libuv-1.44.2-h2bbff1b_0.conda 288 KB
    47. libwebp-1.2.2-h2bbff1b_0.conda 658 KB
    48. libwebp-1.2.4-h2bbff1b_0.conda 67 KB
    49. libwebp-1.3.2-hbc33d0d_0.conda 73 KB
    50. libwebp-base-1.2.4-h2bbff1b_0.conda 279 KB
    51. libwebp-base-1.3.2-h2bbff1b_0.conda 306 KB
    52. lz4-c-1.9.3-h2bbff1b_1.conda 132 KB
    53. lz4-c-1.9.4-h2bbff1b_0.conda 143 KB
    54. mkl-2021.4.0-haa95532_640.conda 114.9 MB
    55. mkl-2023.1.0-h6b88ed4_46358.conda 155.9 MB
    56. mkl-service-2.4.0-py310h2bbff1b_1.conda 44 KB
    57. mkl-service-2.4.0-py38h2bbff1b_0.conda 51 KB
    58. mkl_fft-1.3.1-py38h277e83a_0.conda 139 KB
    59. mkl_fft-1.3.8-py310h2bbff1b_0.conda 170 KB
    60. mkl_random-1.2.2-py38hf11a4ad_0.conda 225 KB
    61. mkl_random-1.2.4-py310h59b6b97_0.conda 227 KB
    62. numpy-1.22.3-py38h7a0a035_0.conda 25 KB
    63. numpy-1.23.4-py38h3b20f71_0.conda 11 KB
    64. numpy-1.26.3-py310h055cbcc_0.conda 11 KB
    65. numpy-base-1.22.3-py38hca35cd5_0.conda 4.9 MB
    66. numpy-base-1.23.4-py38h4da318b_0.conda 6.0 MB
    67. numpy-base-1.26.3-py310h65a83cf_0.conda 6.2 MB
    68. openjpeg-2.4.0-h4fc8c34_0.conda 219 KB
    69. openssl-1.1.1o-h2bbff1b_0.conda 4.8 MB
    70. openssl-1.1.1s-h2bbff1b_0.conda 5.5 MB
    71. openssl-1.1.1w-h2bbff1b_0.conda 5.5 MB
    72. pillow-10.0.1-py310h045eedc_0.conda 788 KB
    73. pillow-9.0.1-py38hdc2b20a_0.conda 923 KB
    74. pillow-9.2.0-py38hdc2b20a_1.conda 922 KB
    75. pip-21.2.2-py36haa95532_0.conda 1.9 MB
    76. pip-21.2.2-py38haa95532_0.conda 1.9 MB
    77. pip-22.2.2-py38haa95532_0.conda 2.3 MB
    78. pip-23.3.1-py310haa95532_0.conda 2.9 MB
    79. pycparser-2.21-pyhd3eb1b0_0.conda 94 KB
    80. pyopenssl-22.0.0-pyhd3eb1b0_0.conda 50 KB
    81. pyopenssl-23.2.0-py310haa95532_0.conda 97 KB
    82. pysocks-1.7.1-py310haa95532_0.conda 28 KB
    83. pysocks-1.7.1-py38haa95532_0.conda 31 KB
    84. python-3.10.0-h96c0403_3.tar.bz2 15.3 MB
    85. python-3.6.13-h3758d61_0.conda 14.6 MB
    86. python-3.8.13-h6244533_0.conda 16.5 MB
    87. python-3.8.15-h6244533_2.conda 18.9 MB
    88. pytorch-1.11.0-py3.8_cuda11.3_cudnn8_0.tar.bz2 1.23 GB
    89. pytorch-1.12.1-py3.10_cuda11.3_cudnn8_0.tar.bz2 1.20 GB
    90. pytorch-1.12.1-py3.8_cuda11.3_cudnn8_0.tar.bz2 1.19 GB
    91. pytorch-mutex-1.0-cuda.tar.bz2 3 KB
    92. requests-2.27.1-pyhd3eb1b0_0.conda 54 KB
    93. requests-2.28.1-py38haa95532_0.conda 100 KB
    94. requests-2.31.0-py310haa95532_0.conda 100 KB
    95. setuptools-58.0.4-py36haa95532_0.conda 776 KB
    96. setuptools-61.2.0-py38haa95532_0.conda 1.0 MB
    97. setuptools-65.5.0-py38haa95532_0.conda 1.1 MB
    98. setuptools-68.2.2-py310haa95532_0.conda 942 KB
    99. six-1.16.0-pyhd3eb1b0_1.conda 18 KB
    100. sqlite-3.38.3-h2bbff1b_0.conda 806 KB
    101. sqlite-3.40.0-h2bbff1b_0.conda 891 KB
    102. sqlite-3.41.2-h2bbff1b_0.conda 894 KB
    103. tbb-2021.8.0-h59b6b97_0.conda 149 KB
    104. tk-8.6.12-h2bbff1b_0.conda 3.1 MB
    105. torchaudio-0.12.1-py310_cu113.tar.bz2 3.7 MB
    106. torchaudio-0.12.1-py38_cu113.tar.bz2 3.7 MB
    107. torchvision-0.12.0-py38_cu113.tar.bz2 9.0 MB
    108. torchvision-0.13.1-py310_cu113.tar.bz2 7.4 MB
    109. torchvision-0.13.1-py38_cu113.tar.bz2 7.4 MB
    110. typing_extensions-4.1.1-pyh06a4308_0.conda 28 KB
    111. typing_extensions-4.3.0-py38haa95532_0.conda 42 KB
    112. typing_extensions-4.9.0-py310haa95532_1.conda 55 KB
    113. tzdata-2023d-h04d1e81_0.conda 117 KB
    114. urllib3-1.26.12-py38haa95532_0.conda 185 KB
    115. urllib3-1.26.18-py310haa95532_0.conda 200 KB
    116. urllib3-1.26.9-py38haa95532_0.conda 187 KB
    117. vc-14.2-h21ff451_1.conda 8 KB
    118. vs2015_runtime-14.27.29016-h5e58377_2.conda 1007 KB
    119. wheel-0.37.1-pyhd3eb1b0_0.conda 33 KB
    120. wheel-0.41.2-py310haa95532_0.conda 127 KB
    121. wincertstore-0.2-py36h7fe50ca_0.conda 14 KB
    122. wincertstore-0.2-py38haa95532_2.conda 15 KB
    123. win_inet_pton-1.1.0-py310haa95532_0.conda 9 KB
    124. win_inet_pton-1.1.0-py38haa95532_0.conda 35 KB
    125. xz-5.2.5-h8cc25b3_1.conda 246 KB
    126. xz-5.2.6-h8cc25b3_0.conda 240 KB
    127. xz-5.4.5-h8cc25b3_0.conda 593 KB
    128. zlib-1.2.12-h8cc25b3_2.conda 116 KB
    129. zlib-1.2.13-h8cc25b3_0.conda 113 KB
    130. zstd-1.5.2-h19a0ad4_0.conda 509 KB
    131. zstd-1.5.5-hd43e919_0.conda 682 KB
    132. ---------------------------------------------------
    133. Total: 4.59 GB
    134. Proceed ([y]/n)?

    这里可以清楚 4.59G

    附上 conda clean 命令大全

    1. usage: conda clean [-h] [-a] [-i] [-p] [-t] [-f]
    2. [-c TEMPFILES [TEMPFILES ...]] [-d] [--json] [-q] [-v] [-y]
    3. Remove unused packages and caches.
    4. Options:
    5. optional arguments:
    6. -h, --help Show this help message and exit.
    7. Removal Targets:
    8. -a, --all Remove index cache, lock files, unused cache packages,
    9. and tarballs.
    10. -i, --index-cache Remove index cache.
    11. -p, --packages Remove unused packages from writable package caches.
    12. WARNING: This does not check for packages installed
    13. using symlinks back to the package cache.
    14. -t, --tarballs Remove cached package tarballs.
    15. -f, --force-pkgs-dirs
    16. Remove *all* writable package caches. This option is
    17. not included with the --all flag. WARNING: This will
    18. break environments with packages installed using
    19. symlinks back to the package cache.
    20. -c TEMPFILES [TEMPFILES ...], --tempfiles TEMPFILES [TEMPFILES ...]
    21. Remove temporary files that could not be deleted
    22. earlier due to being in-use. Argument is path(s) to
    23. prefix(es) where files should be found and removed.
    24. Output, Prompt, and Flow Control Options:
    25. -d, --dry-run Only display what would have been done.
    26. --json Report all output as json. Suitable for using conda
    27. programmatically.
    28. -q, --quiet Do not display progress bar.
    29. -v, --verbose Can be used multiple times. Once for INFO, twice for
    30. DEBUG, three times for TRACE.
    31. -y, --yes Do not ask for confirmation.
    32. Examples:
    33. conda clean --tarballs

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

    虽然搜身   但是还是很大

  • 相关阅读:
    JetPack架构组件之ViewModel和Livedata使用
    【BIGRU预测】基于双向门控循环单元的多变量时间序列预测(Matlab代码实现)
    go基础08-map的内部实现
    文举论金:黄金原油全面走势分析策略独家指导
    Nginx + Tomcat 实现负载均衡
    大学生面试JAVA程序员应该具备的JAVA面试题库
    Git快速入门一篇文章就够了。Git基础使用。如何将本地的文件上传到Gitee?
    【JUC2022】第一章 CompletableFuture
    mysql添加字段,如果有则不添加
    微信小程序自定义头部
  • 原文地址:https://blog.csdn.net/Vertira/article/details/136207314