Hi Paolo,
You can use the following structure to do this right in the module. The first time the module is loaded the library will be automatically installed, and every successive time the import in the try block will succeed and the catch will not be executed.
try:
import library_name
except:
slicer.util.pip_install('library_name')
import library_name
Of course you can use other forms of the Python import lines as well, like
from library_name import module_name