checkvosk.py 419 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
import sys
import subprocess
import pkg_resources

required = {'vosk', 'srt'}
installed = {pkg.key for pkg in pkg_resources.working_set}
missing = required - installed
print ("Missing pachages: ", missing)
if missing and len(sys.argv) > 1 :
    print ("Installing missing pachages: ", missing)
    python = sys.executable
    subprocess.check_call([python, '-m', 'pip', 'install', *missing], stdout=subprocess.DEVNULL)