What is the easiest way to remove all packages installed by pip?

356    Asked by Ayushigupta in Python , Asked on Jun 14, 2021

I'm trying to fix up one of my virtualenvs - I'd like to reset all of the installed libraries back to the ones that match production.

Is there a quick and easy way to do this with pip?

Answered by Dan Peters

You can run the following command to remove all the packages pip uninstall all it saves your virtual environment:-

  pip freeze | xargs pip uninstall -y

To remove all the packages at the same time you can also use the following piece of command as it will work in all the OSs:-

  pip uninstall -r requirements.txt -y


Your Answer

Interviews

Parent Categories