Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I remove all packages installed by PIP? [duplicate]

Tags:

python

pip

I want to revert my Python install back to its base state so I can start using virtualenv. Is there an easy way to uninstall only those packages that have been installed after Python was set up?

like image 333
Cam Avatar asked Jul 03 '19 13:07

Cam


People also ask

How do you purge pip packages?

Uninstalling/removing Python packages using Pip Open a terminal window. To uninstall, or remove, a package use the command '$PIP uninstall <package-name>'. This example will remove the flask package.

Can you uninstall packages with pip?

pip is able to uninstall most installed packages.


1 Answers

The following command should do the trick:

pip freeze > requirements.txt && pip uninstall -r requirements.txt -y

Alternatively you can skip the creation of any intermediate files (i.e. requirements.txt):

pip uninstall -y -r <(pip freeze)
like image 130
Giorgos Myrianthous Avatar answered Sep 28 '22 16:09

Giorgos Myrianthous