In this short guide, you’ll see how to uninstall a package in Python using PIP.
If you’re using Windows, you’ll be able to uninstall a Python package by opening the Windows Command Prompt, and then typing this command:
pip uninstall package_name
Note: the above method would only work if you already added Python to Windows path. Otherwise, check the steps below to uninstall a package.
The Steps
(1) First, type Command Prompt in the Windows Search Box
(2) Next, open the Command Prompt, and you’ll see the following screen with your user name (to avoid any permission issues, you may consider to run the Command Prompt as an administrator):
C:\Users\Ron>
(3) Locate your Python Scripts path. The Scripts folder can be found within the Python application folder, where you originally installed Python.
You can find the Python Scripts path by following these steps:
- Type “Python” in the Windows Search Bar
- Right-click on the Python App, and then select “Open file location“
- Right-click again on the Python shortcut, and then select “Open file location“
- Double-click on the “Scripts” folder and then copy the path
Here is an example of a Python Scripts path:
C:\Users\Ron\AppData\Local\Programs\Python\Python312\Scripts
(4) In the Command Prompt, type cd, followed by space, and then your Python Scripts path:
C:\>cd C:\Users\Ron\AppData\Local\Programs\Python\Python312\Scripts
(5) Press Enter, and you’ll see the following:
C:\Users\Ron\AppData\Local\Programs\Python\Python312\Scripts>
(6) Finally, to uninstall a package in Python, use this command, while specifying the package name that you’d like to uninstall:
pip uninstall package_name
(7) To proceed with the removal of the package, type “y” and then press Enter:
Proceed (y/n)? y
Your Python package will now be removed from Python.
What if you changed your mind, and decided to install that package again?
If that’s the case, you may use the PIP install command to add the package into Python.