You need a Python 3+ environment in your system.
In Linux, you can probably get Python 3 simply with
apt install python3
in Ubuntu, or another package manager, determined by your Linux distribution.
In Windows, you can download it from the official website of Python.
After installation, you can check your Python version by typing python
on the console.
In bash or Windows cmd, type
python foo.py
to directly run the code. Then you can do anything as you wish.
You can also run the code with one or two parameter. Type
python foo.py "找到女朋友"
or
python foo.py 2 "get a girlfriend"
and see what happens.