[Python] Why does pyinstaller generated exe fail with module not found giving a strange module...

Discussão em 'Python' iniciado por Stack, Janeiro 16, 2025.

  1. Stack

    Stack Membro Participativo

    I am running pyinstaller 6.8.0 on Windows 10

    my application runs correctly when called from the terminal (python .../main.py)

    I can build it using pyinstaller with no error messages

    When I run the exe it fails with the error


    File "psiconfig\toml_config.py", line 2, in ModuleNotFoundError: No module named '3c22db458360489351e4__mypyc'
    ​

    Line 2 of tomli_config,py is:

    import toml

    If I run python REPL I am able to import tomli with no errors

    this is my spec file

    # -*- mode: python ; coding: utf-8 -*-


    a = Analysis(
    ['C:\\Users\\jeffw\\projects\\basic_app\\basic_app\\src\\main.py'],
    pathex=[],
    binaries=[],
    datas=[('basic_app/images/icon.png', 'images')],
    hiddenimports=['tomli'],
    hookspath=[],
    hooksconfig={},
    runtime_hooks=[],
    excludes=[],
    noarchive=False,
    optimize=0,
    )
    pyz = PYZ(a.pure)

    exe = EXE(
    pyz,
    a.scripts,
    a.binaries,
    a.datas,
    [],
    name='BasicApp.exe',
    debug=False,
    bootloader_ignore_signals=False,
    strip=False,
    upx=True,
    upx_exclude=[],
    runtime_tmpdir=None,
    console=False,
    disable_windowed_traceback=False,
    argv_emulation=False,
    target_arch=None,
    codesign_identity=None,
    entitlements_file=None,
    icon=['basic_app\\images\\icon.ico'],
    )


    How do I solve this?

    Continue reading...

Compartilhe esta Página