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
- How to convert MD (markdown) file to PDF using Pandoc on macOS Ventura 13
- How to make MD (markdown) document
- How to Install Docker Desktop on mac M1 chip (Apple chip) macOS 12 Monterey
- How to install MySQL Workbench on macOS 12 Monterey mac M1 (2021)
- How to install MySQL Community Server on macOS 12 Monterey (2021)