Я создал exe с помощью pyinstaller, выполнив следующую команду:
pyinstaller app_proto.spec
app_proto.spe c показано ниже:
# -*- mode: python ; coding: utf-8 -*-
block_cipher = None
a = Analysis(['app_proto.py'],
pathex=['C:\\Users\\user01\\Documents\\GitHub Repos\\app\\src'],
binaries=[],
datas=[('C:/Users/user01/AppData/Local/Programs/Python/Python38/Lib/site-packages/dask/dask.yaml', 'dask' )],
hiddenimports=['dask'],
hookspath=[],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False)
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
exe = EXE(pyz,
a.scripts,
[],
exclude_binaries=True,
name='app_proto',
debug=True,
bootloader_ignore_signals=False,
strip=False,
upx=True,
console=True )
a.datas +=[('./icons/application-export.png','C:\\Users\\user01\\Documents\\GitHub Repos\\app\\src\\icons\\application-export.png','DATA')]
a.datas +=[('./icons/application-import.png','C:\\Users\\user01\\Documents\\GitHub Repos\\app\\src\\icons\\application-import.png','DATA')]
a.datas +=[('./icons/application-wave.png','C:\\Users\\user01\\Documents\\GitHub Repos\\app\\src\\icons\\application-wave.png','DATA')]
a.datas +=[('./icons/arrow-out.png','C:\\Users\\user01\\Documents\\GitHub Repos\\app\\src\\icons\\arrow-out.png','DATA')]
a.datas +=[('./icons/border-bottom-thick.png','C:\\Users\\user01\\Documents\\GitHub Repos\\app\\src\\icons\\border-bottom-thick.png','DATA')]
a.datas +=[('./icons/border-left.png','C:\\Users\\user01\\Documents\\GitHub Repos\\app\\src\\icons\\border-left.png','DATA')]
a.datas +=[('./icons/border-right.png','C:\\Users\\user01\\Documents\\GitHub Repos\\app\\src\\icons\\border-right.png','DATA')]
a.datas +=[('./icons/chart--plus.png','C:\\Users\\user01\\Documents\\GitHub Repos\\app\\src\\icons\\chart--plus.png','DATA')]
a.datas +=[('./icons/desktop.ini','C:\\Users\\user01\\Documents\\GitHub Repos\\app\\src\\icons\\desktop.ini','DATA')]
a.datas +=[('./icons/edit-list-rtl.png','C:\\Users\\user01\\Documents\\GitHub Repos\\app\\src\\icons\\edit-list-rtl.png','DATA')]
a.datas +=[('./icons/folder-open-document.png','C:\\Users\\user01\\Documents\\GitHub Repos\\app\\src\\icons\\folder-open-document.png','DATA')]
a.datas +=[('./icons/marker.png','C:\\Users\\user01\\Documents\\GitHub Repos\\app\\src\\icons\\marker.png','DATA')]
a.datas +=[('./icons/minus-circle.png','C:\\Users\\user01\\Documents\\GitHub Repos\\app\\src\\icons\\minus-circle.png','DATA')]
a.datas +=[('./icons/minus.png','C:\\Users\\user01\\Documents\\GitHub Repos\\app\\src\\icons\\minus.png','DATA')]
a.datas +=[('./icons/report-word.png','C:\\Users\\user01\\Documents\\GitHub Repos\\app\\src\\icons\\report-word.png','DATA')]
a.datas +=[('./icons/script-attribute-y.png','C:\\Users\\user01\\Documents\\GitHub Repos\\app\\src\\icons\\script-attribute-y.png','DATA')]
a.datas +=[('./icons/system-monitor.png','C:\\Users\\user01\\Documents\\GitHub Repos\\app\\src\\icons\\system-monitor.png','DATA')]
coll = COLLECT(exe,
a.binaries,
a.zipfiles,
a.datas,
strip=False,
upx=True,
upx_exclude=[],
name='app_proto')
На некоторых ПК при запуске exe с использованием режима --onedir
с включенной отладкой, отображается следующий вывод:
[2020] LOADER: Running pyi_rth_mplconfig.py
[2020] LOADER: Running pyi_rth_mpldata.py
[2020] LOADER: Running pyi_rth_pyqt5.py
[2020] LOADER: Running app_proto.py
Traceback (most recent call last):
File "src\app_proto.py", line 7, in <module>
File "c:\users\user01\appdata\local\programs\python\python38\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 623, in exec_module
File "src\pyinstallerimports\__init__.py", line 1, in <module>
File "c:\users\user01\appdata\local\programs\python\python38\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 623, in exec_module
File "site-packages\cchardet\__init__.py", line 1, in <module>
ImportError: DLL load failed while importing _cchardet: The specified module could not be found.
[2020] Failed to execute script app_proto
[2020] LOADER: OK.
[2020] LOADER: Cleaning up Python interpreter.
Как упоминалось в вопросе, exe работает на нескольких ПК (некоторые из которых никогда не имели python), если это имеет значение).
В каталоге exe есть папка с именем cchardet
с файлом .pyd _cchardet
Кто-нибудь знает, как это исправить?