import sys import subprocess # implement pip as a subprocess: def installer(): subprocess.check_call([sys.executable, '-m', 'pip', 'install', 'mysql-connector-python'])