Want more features on Pastebin? Sign Up, it's FREE!

Uninstall all pip packages at once

By: evandrix on Sep 5th, 2011  |  syntax: Bash  |  size: 0.41 KB  |  views: 705  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #!/bin/bash
  2.  
  3. #if [ "$#" -ne 1 ]; then
  4. #    echo "Usage: $0 <py pkg name using \$(pip freeze -l)>"
  5. #    exit
  6. #fi
  7.  
  8. for plugin in $(pip freeze -l); do
  9.     PLUGIN=$(echo "$plugin" | awk -F == '{print $1}')
  10.     echo "Uninstalling $PLUGIN..."
  11.     expect -c "spawn pip uninstall $PLUGIN
  12.    expect {
  13.         \"Proceed (y/n)?\" {
  14.                 send \"y\r\n\"
  15.                 expect {
  16.                         exit
  17.                 }
  18.         }
  19.    }"    
  20. done
clone this paste RAW Paste Data