Removing Pip's Cache?

502    Asked by AlanTaylor in Python , Asked on Nov 17, 2022

 I need to install psycopg2 v2.4.1 specifically. I accidentally did:

pip install psycopg2
Instead of:
pip install psycopg2==2.4.1
That instals 2.4.4 instead of the earlier version.

Now even after I uninstall psycopg2 and attempt to reinstall with the correct version, it appears that pip is re-using the cache it downloaded the first time. How can I force pip to clear out its download cache and use the specific version I'm including in the command? Please guide how to clear the pip cache?

Answered by Al German

Clear the pip cache cache directory where appropriate for your system


Linux and Unix
~/.cache/pip # and it respects the XDG_CACHE_HOME directory.
OS X
~/Library/Caches/pip
Windows
%LocalAppData%pipCache
UPDATE
With pip 20.1 or later, you can find the full path for your operating system easily by typing this in the command line:
pip cache dir
Example output on my Ubuntu installation:
➜ pip3 cache dir
/home/tawanda/.cache/pip


Your Answer

Interviews

Parent Categories