How do I remove all packages installed by PIP?

do following

  1. store all the pip packages in requirements.txt

    python -m pip freeze > requirements.txt
    
  2. remove all pip packages which menetioned in requirements.txt

    python -m pip uninstall -r requirements.txt
    

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)

Tags:

Python

Pip