T D
T D

Reputation: 509

Simplest way to uninstall all PIP packages outside of venv on Windows

I have seen some techniques to uninstall all pip packages using lists. Most answers to questions appear to be linux based. Any recommendations as I had pip installed quite a few libraries on an old windows laptop outside of a venv a few years back.

Thanks!

Upvotes: 0

Views: 1710

Answers (2)

ClumsyPuffin
ClumsyPuffin

Reputation: 4059

You can run this in command prompt(no adminstrator priveleges) prompt:

pip freeze > packagelist.txt
pip uninstall -r .\packagelist.txt -y

Another more programmatic way would be :

$packages = pip freeze 

foreach ($package in $packages ){
pip uninstall $package -y

}

both work the same but the first example creates a .txt file, you may want to delete that

Upvotes: 1

Sanil Khurana
Sanil Khurana

Reputation: 1169

Have you tried this

pip freeze | xargs pip uninstall -y

Upvotes: 0

Related Questions