Python Pip Cache – Where is Pip Cache Folder?

pippython

Where is the Python pip cache folder? I had an error during installation and now reinstall packages using cache files. Where is that directory? I want to take a backup of them for installation in the future. Is it possible?

For example, I have this one

Using cached cssselect-0.9.1.tar.gz

I searched google for this directory but nothing I saw, is learning how to install from a folder, I want to find the default cache directory.

And another question: Will these cache files stay in that directory, or will they be removed soon?

Best Answer

The default location for the cache directory depends on the Operating System:

Unix

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

macOS

~/Library/Caches/pip

Windows

<CSIDL_LOCAL_APPDATA>\pip\Cache

Wheel Cache

pip will read from the subdirectory wheels within the pip cache directory and use any packages found there. [snip]

https://pip.pypa.io/en/latest/reference/pip_install/#caching

The location of the cache directory can be changed via the command line option --cache-dir.