A python script to Uninstall all python packages at once.π
-
Creates a file named
requirements.txtand writes the output of thepip freezecommand to it. Thepip freezecommand lists all the packages that are currently installed in your Python environment and their versions. -
Reads the contents of the
requirements.txtfile, which contains the list of packages and their versions, and splits them into a list of strings, where each string is a package name and version. -
Loops through the list of packages and uninstalls each one using the
pip uninstallcommand. The-yoption is used to answer "yes" to any prompts asking to confirm the uninstallation.This code can be used to create a snapshot of the currently installed packages in a Python environment and then to uninstall all of those packages at once. This can be useful for scenarios where you want to start with a clean slate and have no installed packages, or when you want to ensure that you are only using the packages that are explicitly listed in the
requirements.txtfile.π
You need to have the following software installed on your machine:
Python 3.xpipRequired packagesPermission
- To use this script, simply run the following command:
python main.py
- The script includes error handling for both the creation of the
requirements.txtfile and the uninstallation of packages. In case of any errors, the error message will be printed to the console.
The project is licensed under MIT license. See the license file for details.
This project is used by the following individual:
Saif IslamSaimoon Islam
Feel free to contribute to this project by opening an issue or submitting a pull request.
For support, email [email protected] or join facebook community.(β'β‘'β)