2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Pyinstaller DLL 不足のエラー解決 (dll was not found/ No module named XXX)

Last updated at Posted at 2021-11-26

解決方法

最初のPyinstallerの実行で生成された(Pythonファイル名).spec を直接編集して不足しているdll/Moduleのパスを追加する。

a = Analysis(
...
binaries=[(r'.\venv_exif\Lib\site-packages\pyexiv2\lib\py3.8-win\exiv2api.pyd', '.'),(r'.\venv_exif\Lib\site-packages\pyexiv2\lib\exiv2.dll', '.')]
...

その後、spec名指定でPyinstallerを実行する。

Pyinstaller (Pythonファイル名).spec

もしくは

--add-binary オプションで指定する。

Pyinstaller (Pythonファイル名).py --add-binary "\venv_exif\Lib\site-packages\pyexiv2\lib\py3.8-win\exiv2api.pyd"

##Issue
Imported package used in python script : pyexiv2
Exe creation by Pyinstaller was completed successfully but runtime error occurs.

###Error 1 (missing exiv2.dll)

pyimod04_ctypes.PyInstallerImportError: 
Failed to load dynlib/dll 'C:\\Users\\xxx\\AppData\\Local\\Temp\\_MEI120722\\pyexiv2\\lib\\exiv2.dll'. 
Most likely this dynlib/dll was not found when the application was frozen.

###Error 2 (missing exiv2api.pyd)

ModuleNotFoundError: No module named 'exiv2api'

##Solution :
In spec file, you should specify exiv2api.pyd and exiv2.dll

a = Analysis(
...
binaries=[(r'.\venv_exif\Lib\site-packages\pyexiv2\lib\py3.8-win\exiv2api.pyd', '.'),(r'.\venv_exif\Lib\site-packages\pyexiv2\lib\exiv2.dll', '.')]
...

(or using option --add-binary)

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?