Is it safe to delete ~/.cache/pip directory

后端 未结 2 1698
无人及你
无人及你 2020-12-16 12:49

I have limited space on my server, and I am thinking to delete the cache of the PIP. I am not sure if its safe to delete or not.

ls  ~/.cache/pip/

相关标签:
2条回答
  • 2020-12-16 13:16

    Since pip 20.1b1, which was released on 21 April 2020 and "added pip cache command for inspecting/managing pip’s wheel cache", you no longer need to. Instead, you can issue this command:

    pip cache purge
    

    The reference guide is here:
    https://pip.pypa.io/en/stable/reference/pip_cache/
    The corresponding pull request is here.

    0 讨论(0)
  • 2020-12-16 13:32

    According to pip's caching documentation from version 6 you can use the --no-cache-dir option.

    But that didn't help me as I was using a wrapper (pinax starter projects) that runs pip in the background to install several packages. Since I kept getting an pip.exceptions.HashErrors ('hashes don't match the requirement file) and I didn't want to temper with its code I renamed the pip cache folder and tried running my wrapper again. Once I noticed there weren't issues I proceeded to delete the entire cache pip folder. I haven't had any problem after that. So I can assume it is entirely a safe operation to delete pip's cache folder.

    These are the locations where you can find your pip cache:

    Unix

    ~/.cache/pip and it respects the XDG_CACHE_HOME directory.

    OS X

    ~/Library/Caches/pip.

    Windows

    \pip\Cache

    0 讨论(0)
提交回复
热议问题