TerminalCalm's picture
Initial commit
44e905f verified
raw
history blame contribute delete
731 Bytes
import subprocess
import sys
def clean_package(package_name):
"""Force uninstalls a package to ensure a clean state."""
print(f"Attempting to forcefully uninstall {package_name}...")
# Use -y to automatically confirm and run command
result = subprocess.run(
[sys.executable, "-m", "pip", "uninstall", "-y", package_name],
capture_output=True,
text=True
)
if result.returncode == 0:
print(f"Successfully uninstalled {package_name}.")
else:
# It's okay if it fails, it might just not be installed.
print(f"{package_name} not found or uninstall failed, continuing.")
if __name__ == "__main__":
clean_package("gradio")
clean_package("gradio_client")