Я импортировал вместе с другими пакет workalendar в свой python скрипт, и он отлично работает. Я компилирую его с помощью Pyinstaller без ошибок, но при запуске exe-файла появляется предупреждение: pkg_resources.DistributionNotFound: Распределение «рабочий календарь» не найдено и требуется приложению.
Я выполняю это:
C:\Python\Python38\Scripts\pyinstaller.exe --onefile .\main.spec
И когда я запускаю exe-файл, возвращается:
Traceback (most recent call last):
File "main.py", line 6, in <module>
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "c:\python\python38\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 623, in
exec_module
exec(bytecode, module.__dict__)
File "clases\menu.py", line 7, in <module>
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "c:\python\python38\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 623, in
exec_module exec(bytecode, module.__dict__)
File "clases\dipole\dipole.py", line 32, in <module>
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "c:\python\python38\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 623, in exec_module exec(bytecode, module.__dict__)
File "site-packages\workalendar\__init__.py", line 5, in <module>
File "site-packages\pkg_resources\__init__.py", line 482, in get_distribution
File "site-packages\pkg_resources\__init__.py", line 358, in get_provider
File "site-packages\pkg_resources\__init__.py", line 901, in require
File "site-packages\pkg_resources\__init__.py", line 787, in resolve
pkg_resources.DistributionNotFound: The 'workalendar' distribution was not found and is required by the application
[5716] Failed to execute script main
My spe c file:
# -*- mode: python ; coding: utf-8 -*-
block_cipher = None
a = Analysis(['main.py'],
pathex=['C:\\Users\\user\\Downloads\\MyScript',
'C:\\Python\\Python38\\Lib\\site-packages\\workalendar'],
binaries=[],
datas=[],
hiddenimports=['pkg_resources.py2_warn', 'workalendar-9.0.0.dist-info/*', 'workalendar-9.0.0.dist-info'],
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,
a.binaries,
a.zipfiles,
a.datas,
[],
name='main',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
upx_exclude=[],
runtime_tmpdir=None,
console=True )
В чем проблема?