Python “pip uninstall” Command Tutorial

Python packages can be managed in different ways with a different commands. The Python package management is done via search, install, uninstall, update, etc. The pip command is used to manage packages where the “pip uninstall” command can be used to remove or uninstall the already installed packages. The “pip uninstall” command can only uninstall pip installed packages.

“pip uninstall” Command Syntax

The pip uninstall command is like below.

pip uninstall OPTION PACKAGE_NAME
  • OPTION is used to uninstall package without confirmation or for current user.
  • PACKAGE_NAME is the Python package we want to remove or uninstall.

Uninstall Current User Python Packages

Python packages can be installed for system-wide or for the current user. Python packages installed for the current user can be uninstalled by using the python uninstall command with the --user option.

$ pip uninstall django

During uninstall, the package files and directories are detected and confirmation is required.

Uninstall Global Python Packages

Global python packages are installed for all users. The global packages can be also uninstalled by using the sudo command like below.

$ sudo pip uninstall django

Uninstall Python Package without Confirmation

During uninstalling the python package it generally requires confirmation in order to uninstall the python package. When working with batch scripts or commands this may create a problem as we cannot confirm the uninstallation interactively. The -y option can be used to automatically confirm the package uninstallation without any interruption.

$ pip uninstall -y django

Leave a Comment