간단한 버전

os.system 사용

import os

os.system(f"tar -xvf {ipk_path} -C {output_dir}")

에러 핸들링 가능한 방법

subprocess.Popen 사용

import subprocess

res = subprocess.Popen(f"tar -xvf {ipk_path} -C {output_dir}", stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)

if res.wait() != 0:
    _, error = res.communicate()
    print(error)
else:
    print('ok')