How Do I Include .dll File In Executable Using Pyinstaller?
Solution 1:
When I faced problem described here https://github.com/ContinuumIO/anaconda-issues/issues/443 my workaround was
pyinstaller -F --add-data vcruntime140.dll;. myscript.py
-F
- collect into one *.exe file
.
- Destination path of dll in exe file
from docs http://pyinstaller.readthedocs.io/en/stable/spec-files.html#adding-data-files
Solution 2:
Add the current project folder to Path, then Create EXE using following command:
pyinstaller --add-binary AutoItX3_x64.dll;. program_name.py
Create folder \dist\program_name\autoit\lib
in tge current project folder, and paste AutoItX3_x64.dll
in it.
Solution 3:
As the selected answer didn't work for the case of using libportaudio64bit.dll, I put my working solution here.
For me, the working solution is to add _sounddevice_data folder where the .exe file is located then making a portaudio-binaries folder in it and finally putting libportaudio64bit.dll in the recently created folder.
Hope it helps!
Solution 4:
Here is a modified version of Ilya's answer.
pyinstaller --onefile --add-binary ".venv/Lib/site-packages/example_package/example.dll;." myscript.py
It wasn't clear to me when first stumbling into this issue that you must tell PyInstaller exactly where to find the given file (either via relative or absolute path) if it is not already on your PATH
.
I have more discussion on how I found exactly which DLL was missing in this answer to a similar question.
I much prefer this solution to manually copying DLLs into the export directory, since single EXE is better for distributing utilities to non-programmers.
Post a Comment for "How Do I Include .dll File In Executable Using Pyinstaller?"