How to remove all packages installed by PIP in Python

When you are developing in Python, you will probably use Python packages a lot. If you are not using virtualenv and directly developing with a local Python environment, the number of packages you installed would a lot and at some point, you might want to do some cleanup.

Note: In this demo, I’m using macOS Big Sur (11.0.1) but the method should work on any environment.

How to uninstall the package individually

To uninstall individual Python package, you need to execute the below command in the CLI.

pip uninstall [package name]

In the [package name], put the name of the package you want to uninstall.

How to uninstall all the Python packages

To uninstall all the Python packages, use the below command.

pip uninstall -y -r <(pip freeze)

Above command will uninstall all requirement file (by using -r) and accept all (by using -y ) that is in the freeze list

As you can see the above screenshots, it will uninstall all the packages you have installed.

Please check out also How to use VirtualEnv in Python to learn more about an organized way to develop a Python app.

Latest Posts

Feel free to share this post!

Scroll to Top