Fade-org
@Fade-org
Люблю Python, потихоньку учу C#.

Python3 ошибка после компиляции .py в .exe, что делать?

Всем привет, написал программу, она создает и декодирует qrcode, все это на граф интерфейса благодаря tkinter. Программа работает в формате .py, но когда я запустил pyinstaller -F qrcode.py, то она перестала работать. Вот ошибка в консоле при запуске программы
Traceback (most recent call last):
  File "site-packages\PyInstaller\loader\pyiboot01_bootstrap.py", line 151, in __init__
  File "ctypes\__init__.py", line 373, in __init__
FileNotFoundError: Could not find module 'libiconv-2.dll' (or one of its dependencies). Try using the full path with constructor syntax.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "site-packages\pyzbar\zbar_library.py", line 58, in load
  File "site-packages\pyzbar\zbar_library.py", line 50, in load_objects
  File "site-packages\pyzbar\zbar_library.py", line 51, in <listcomp>
  File "ctypes\__init__.py", line 451, in LoadLibrary
  File "site-packages\PyInstaller\loader\pyiboot01_bootstrap.py", line 153, in __init__
__main__.PyInstallerImportError: Failed to load dynlib/dll 'libiconv-2.dll'. Most probably this dynlib/dll was not found when the application was frozen.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "site-packages\PyInstaller\loader\pyiboot01_bootstrap.py", line 151, in __init__
  File "ctypes\__init__.py", line 373, in __init__
FileNotFoundError: Could not find module 'C:\Users\79629\AppData\Local\Temp\_MEI40122\pyzbar\libiconv-2.dll' (or one of its dependencies). Try using the full path with constructor syntax.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "qrcode.py", line 5, 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 "d:\python\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 623, in exec_module
    exec(bytecode, module.__dict__)
  File "site-packages\pyzbar\pyzbar.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 "d:\python\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 623, in exec_module
    exec(bytecode, module.__dict__)
  File "site-packages\pyzbar\wrapper.py", line 139, in <module>
  File "site-packages\pyzbar\wrapper.py", line 136, in zbar_function
  File "site-packages\pyzbar\wrapper.py", line 115, in load_libzbar
  File "site-packages\pyzbar\zbar_library.py", line 60, in load
  File "site-packages\pyzbar\zbar_library.py", line 50, in load_objects
  File "site-packages\pyzbar\zbar_library.py", line 51, in <listcomp>
  File "ctypes\__init__.py", line 451, in LoadLibrary
  File "site-packages\PyInstaller\loader\pyiboot01_bootstrap.py", line 153, in __init__
__main__.PyInstallerImportError: Failed to load dynlib/dll 'C:\\Users\\79629\\AppData\\Local\\Temp\\_MEI40122\\pyzbar\\libiconv-2.dll'. Most probably this dynlib/dll was not found when the application was frozen.
[9028] Failed to execute script qrcode


Как я понял ошибка при импорте модуля
from pyzbar.pyzbar import decode

Как фиксить?
  • Вопрос задан
  • 840 просмотров
Решения вопроса 1
@Andy_U
У вас dll libiconv-2.dll потерялась. Почитайте документацию к Pyinstaller, как ее гвоздями к сборке прибить.
Ответ написан
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы