With the Arduino Uno’s hardware capabilities of just 2KB of RAM and 32kB of Flash, running python on it is impossible.
Do the voice-recognition on your computer and send pin toggle commands (e.g. via serial) to the Uno.
Only bigger microcontrollers such as an ESP32 (4MB flash, 512kB RAM, …) have a chance at running python, e.g. using Micropython (1. Getting started with MicroPython on the ESP32 — MicroPython latest documentation)