Ask a Question
Ask Question Login
Corporate Training
  1. Community
  2. Python
  3. Question
Python

Removing pip's cache?

Asked by Ben Butler Jul 4, 2021 51.9K views 2 answers
Share

About this question

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

pip install psycopg2

Instead of:

pip install psycopg2==2.4.1

That installs 2.4.4 instead of the earlier version.

Now even after I pip 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 pip cache?

Your answer

2 Answers

Ranjana Admin JanBask Expert Latest answer

Answered on May 14, 2024

To remove Pip's cache, you can use the following command:

pip cache purge

This command removes all cached files from Pip's cache directory. If you want to remove specific packages from the cache, you can use:

pip cache remove 

Replace with the name of the package you want to remove from the cache.




Was this helpful?

More Python discussions

Learn & Explore

Free tutorials and interview questions from industry experts — learn the skill, then get ready to prove it.

Latest Python Blogs

Guides, tips and career advice on Python from JanBask experts.