I’m trying to create .exe for my python projects but pyinstaller is giving no module found error.
Here is how my folder structure looks like.
I want to create executable for Project 1, 2 and 3 which uses utils.py
present in Common folder.
In main.py
here is the code snippet that I have used to import files from Common module.
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
sys.path.append(os.path.dirname(SCRIPT_DIR))
from Common import utils
I tried to change .spec
file as well, but no luck.
a = Analysis(
['..\Project1\main.py'],
pathex=['Main Folder Path'],
binaries=[],
datas=['Common'],
hiddenimports=[],
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=[],
noarchive=False,
)
Ran this cmd from Main folder
pyinstaller Project1main.py --onefile --windowed
Ran this cmd from Project 1 folder
pyinstaller main.py --onefile --windowed
Python==3.11 and PyInstaller==6.4.0