In this post, we will learn more about How to remove all packages installed by pip which we can perform using a fixed number of steps by following the commands and directions given there and executing the where we can also perform the same even uninstall pip setuptools which will help in removing both pip and all the package to uninstall that we want to execute as per our requirements.
Removing All the Packages
There are around six steps that we need to follow to get the desired thing done and we need to simply follow the steps given below to get it done.
- Open a terminal or command prompt on your system.
- Type ‘pip freeze’ to get a list of all the installed package.
- Save the output of pip freeze to a file by running pip freeze > requirement. txt(which we used previously in a number of posts.
- Open the requirements.txt (The same file we used earlier file and remove any package that you want to keep.
- Run pip uninstall -r requirements.txt -y to uninstall all package listed in the requirements .txt file.
- You may want to delete the requirements. txt file after you’re done.
There are a number of things we need to keep in mind as it is a very powerful tool and action to do as it may lead to removing all which might include some useful package Be careful when using this command, as it will remove all package install by pip, including those that are necessary for your system to function properly. Make sure you have a backup or a way to reinstall necessary package if needed.
Here we have given an example of a command to execute and get it done by yourself.
python -m pip uninstall pip setuptools
This will remove both pip and setup tools that are required to install package with pip. If you later want to reinstall pip, you can do so by downloading and running the get-pip .oyscript from the official Python website.
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py python get-pip.py
The above-given code is said to be constructive as it will help in reinstalling the same depending upon your system which supports which of the package you are installing.
To learn more about How to remove all package installed by pip visit: by stack overflow
To learn more about python solutions to different python problems and tutorials for the concepts we need to know to work on python programming along with different ways to solve any generally asked problems: How To Pass-Variables From A Java & Python Client To A Linux/Ubuntu Server Which Is Running C?.