How do I clear the pip cache?

261    Asked by ChristopherPaterson in Python , Asked on Aug 8, 2023

 I want to install psycopg2 v2.4.1 particularly. However I have done a mistake.

Pip install psycopg2
Rather than
Pip install osycopg2==2.4.1
This installed 2.4.4 rather than the earlier version.
Now after I pip uninstall psycopg2 and try to reinstall with the right version, it shows that pip re-uses the cache it downloaded initially. 

How to force pip to wipe the downloaded cache and utilize the certain version that is in the command?

Answered by Dan Peters

When you wish to force pip to wipe the download cache and utilize the certain version then you can use the no-cache-dir command. When the older version of pip is used, you must update it with pip install - u pip to wipe off the pip cache. You can also utilize the pip cache remove command that clears a certain package from the pip’s cache folder. You can also deploy the pip cache purge to wipe the files kept in the pip’s cache folder. The Python online training offered at JanBask Training gives you an experience like offline classes thereby saving the students from the tiring journey to travel to the physical locations. The course provides a total Python discipline’s preparation by touching on every core concept from basic to advanced thereby making your job ready to face the tough competitive market.

Your Answer


Parent Categories