import subprocess result = subprocess.run(['which', 'python3'], capture_output=True, text=True) print(f"python3: {result.stdout}") result = subprocess.run(['python3', '-c', 'import pytesseract; print(pytesseract.__version__)'], capture_output=True, text=True) print(f"pytesseract: {result.stdout.strip() or result.stderr.strip()}") result = subprocess.run(['python3', '-c', 'import PIL; print(PIL.__version__)'], capture_output=True, text=True) print(f"PIL: {result.stdout.strip() or result.stderr.strip()}")