Spaces:
Build error
Build error
File size: 672 Bytes
873d0cf |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
import subprocess
def install_library(library):
try:
result = subprocess.run(
["pip", "install", library],
check=True,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
)
return result.returncode == 0
except subprocess.CalledProcessError:
return False
def uninstall_library(library):
try:
result = subprocess.run(
["pip", "uninstall", "-y", library],
check=True,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
)
return result.returncode == 0
except subprocess.CalledProcessError:
return False
|