I have some python code test.py
It imports some modules such as import numpy as np
I want to be able to run this code using python test.py
However it fails because module numpy is not installed.
Is it possible to add a line to python code to automatically install a module if its not already installed?
Additionally is it possible to make the module install in the local folder to the test.py file, like a .dll in c++
Thanks
os.system("pip install numpy")oros.system("python -m pip install numpy"). Eventually you canimport pipbecause it is Python module and then you use it in your code. But for more details you would have to find documentation forpipmodule