File size: 352 Bytes
46ddfef
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import importlib.util
import subprocess
import sys


def is_installed(package):
    try:
        spec = importlib.util.find_spec(package)
    except ModuleNotFoundError:
        return False

    return spec is not None


def run_pip(command, desc):
    python = sys.executable
    subprocess.check_call([python, "-m", "pip", *command.split(" ")])