I wrote this code to test some imports:
import fnmatch
import os
import psutil
import pygetwindow as window
from time import sleep
import win32api
import PySimpleGUI as pys
import pyautogui as py
from time import sleep
import webbrowser
import winsound
import importlib.util
from random import randint
from datetime import date
import locale
layout = [
[pys.Text(f'Complete =)', size=(25, 0))],
]
jan = pys.Window('Test', layout=layout, finalize=True)
jan.read()
I then made an executable using freeze, and sometimes the following error appears:
ModuleNotFoundError: No module named: (lib)
It's always a different (lib). I tried to run pip install (lib) for each (lib) but that didn't work.
Is there some way to check if some (lib) is installed and if it isn't, automatically download that (lib) in code?