Пробую в случае отсутствия необходимого мне модуля, установить, и далее запустить мой скрипт.
try:
import pyAesCrypt
print('package: pyAesCrypt found')
except:
mod_inst = subprocess.Popen("pip3 install pyAesCrypt", shell=True)
mod_inst.wait()
import pyAesCrypt
print('package: ' + package + ' installed')
Результат:Collecting pyAesCrypt
Using cached https://files.pythonhosted.org/packages/c5/99/ebae89da08a443d0191eff631d66b71955eec7e370e2a309d85e499ca18a/pyAesCrypt-0.4.3-py3-none-any.whl
Requirement already satisfied: cryptography in /usr/lib/python3/dist-packages (from pyAesCrypt) (2.6.1)
Installing collected packages: pyAesCrypt
Successfully installed pyAesCrypt-0.4.3
Traceback (most recent call last):
File "smb.py", line 6, in <module>
import pyAesCrypt
ModuleNotFoundError: No module named 'pyAesCrypt'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "smb.py", line 13, in <module>
import pyAesCrypt
ModuleNotFoundError: No module named 'pyAesCrypt'