Last active
June 17, 2021 14:12
-
-
Save kirshiyin89/bfce68121fbd4b5f3ea73c57e68d9957 to your computer and use it in GitHub Desktop.
Uninstall python packages in PyWebIO GUI
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pywebio.output import * | |
from pywebio.input import * | |
from pip import _internal | |
from pip._internal.utils.misc import get_installed_distributions | |
import time | |
put_markdown('Pip Package Manager') | |
installed_packages = get_installed_distributions() | |
installed_packages_set = { package for package in ["%s==%s" % (i.key, i.version) | |
for i in installed_packages] } | |
package = select("Choose a package to uninstall", sorted(installed_packages_set)) | |
print("you chose to remove", package) | |
_internal.main(['uninstall', '-y', package]) | |
put_text(f"Uninstalling {package}. Please wait until it is removed!") | |
put_processbar('bar') | |
for i in range(1, 11): | |
set_processbar('bar', i / 10) | |
time.sleep(0.05) | |
put_markdown(f"Successfully uninstalled {package}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment