(Edit: I made a typo when writing this question: I put quotation mark around "pyparsing" in script. Thanks @dswdsyd)
When running a python script, there's only python standard library on target machine. When a package is needed, I have to install it first. For example, When I tried to install pyparsing and import it:
subprocess.call([sys.executable, "-m", "pip", "install", "pyparsing"])
import pyparsing
I got error:
ModuleNotFoundError: No module named 'pyparsing'
So how to install and import a package in the same python script?
[Update:] In the second run of the script, the package can be imported. Strange.
subprocesscall and provide it?