diff --git a/pipwizard.py b/pipwizard.py index bfb5df2..cac160c 100644 --- a/pipwizard.py +++ b/pipwizard.py @@ -1,12 +1,31 @@ import importlib import subprocess -def install_lib (pkg): +print(''' +(1) Install library +(2) Upgrade library +(3) Uninstall library''') +option = input("Enter opton: ") + +if option == "1": + print() + install_lib = input("Enter library name: ") + try: - importlib.import_module(pkg) - print(f"{pkg} is already installed") + importlib.import_module(install_lib) + print(f"{install_lib} is already installed") except ImportError: - subprocess.check_call(["pip", "install", pkg]) - print(f"{pkg} had been installed.") + subprocess.check_call(["pip", "install", install_lib]) + print(f"{install_lib} had been installed.") + +elif option == "2": + upgrade_lib = input("Enter library name: ") + + subprocess.check_call(["pip", "install", "--upgrade", upgrade_lib]) + print(f"{upgrade_lib} has been upgraded.") + +elif option == "3": + uninstall_lib = input("Enter library name: ") -install_lib("pyperclip") \ No newline at end of file + subprocess.check_call(["pip", "uninstall", uninstall_lib]) + print(f"{uninstall_lib} had been uninstalled.")