Saturday, November 14, 2020

Python: How to Uninstall All Packages using PIP


This tutorial explain you how to uninstall package using PIP. You can use 3 option. Please see the command below.

Option 1

Use below command

$ pip freeze | xargs pip uninstall -y

Option 2

If there are any packages which were installed usig VCS, then we will exclude those . And then will remove the packages

$ pip freeze | grep -v "^-e" | xargs pip uninstall -y

Option 3

Get the list of all Python pip package in the requirements.txt file – Note: This OVERWRITES the Existing requirements.txt else will create new one.

$ pip freeze > requirements.txt

Remove all packages - one by one

$ pip uninstall -r requirements.txt

Remove all packages at once

$ pip uninstall -r requirements.txt -y


Reference :


Previous Post
Next Post

0 komentar: