pip uninstall – A Quick Guide

Rate this post

Syntax and Usage

python -m pip uninstall [options] <package>      
python -m pip uninstall [options] -r <requirements file>                          

Β  Β Β  Β Β Β Β Β Β Β Β Β Β 

  • Specify a specific package by name to uninstall single package
  • Path to requirements file which uninstalls all packages listed therein.

Available Options and Command-Line Switches

Used in place of [options] as seen in the above syntax.

FlagExplanation
-y
--yes
Suppresses confirmation for uninstall.
-r <file>
--requirement <file>
Path to requirements file which uninstalls all packages listed therein.
This option can be utilized multiple times.
--root-user-action <root_user_action>If command is executed as root user – Unix Systems

Examples

python -m pip uninstall uncompyle6

Note the uncompyle6 package along with any accompanying packages included in the initial install are uninstalled.

python -m pip uninstall -yes Sphinx

Will uninstall Sphinx without prompting (y/n) confirmation.

python -m pip uninstall -r β€œD:\Projects\MyProject\requirements.txt”

Uninstalls all packages named in the requirements.txt file. See video: