What is pip's `--no-cache-dir` good for?

后端 未结 5 722
清酒与你
清酒与你 2021-01-30 07:55

I\'ve recently seen the --no-cache-dir being used in a Docker file. I\'ve never seen that flag before and the help is not explaining it:

 --no-cache         


        
5条回答
  •  耶瑟儿~
    2021-01-30 08:15

    1. Cached is: store away in hiding or for future use
    2. Used for
    • store the installation files(.whl, etc) of the modules that you install through pip
    • store the source files (.tar.gz, etc) to avoid re-download when not expired
    1. Possible Reason you might want to disable cache:
    • you don't have space on your hard drive
    • previously run pip install with unexpected settings
      • eg:
        • previously run export PYCURL_SSL_LIBRARY=nss and pip install pycurl
        • want new run export PYCURL_SSL_LIBRARY=openssl and pip install pycurl --compile --no-cache-dir
    • you want to keep a Docker image as small as possible

    Links to documentation

    https://pip.pypa.io/en/stable/reference/pip_install/#caching – @emredjan https://pip.pypa.io/en/stable/reference/pip_install/ - @mikea

提交回复
热议问题