How to remove all packages installed by pip with Python?

Sometimes, we want to remove all packages installed by pip with Python.

In this article, we’ll look at how to remove all packages installed by pip with Python.

How to remove all packages installed by pip with Python?

To remove all packages installed by pip with Python, we run pip uninstall.

To use it, we run

pip freeze | xargs pip uninstall -y

to run pip freeze to get the list of packages installed.

And then we pipe that to xargs pip uninstall -y to remove all the packages listed by pip freeze with pip uninstall.

We use the -y to remove everything without needing confirmation.

Conclusion

To remove all packages installed by pip with Python, we run pip uninstall.