I\'ve been repeatedly making good PyInstaller executables of a Tkinter utility program, and suddenly this morning the resulting executable fails with a \"can\'t import\" error f
I encounter similar issues while packaging a Python script imported openpyxl
. Here is my solution.
Step 1: install the python module, openpyxl
$ wine python.exe Scripts/pip.exe install openpyxl
Step 2: add the openpyxl
path
Append the openpyxl
path (~/.wine/drive_c/Python27/Lib/site-packages
) to pathex
in the Analysis
object in the application spec file (e.g.,ProcessSpreadsheet.spec
).
a = Analysis(['ProcessSpreadsheet.py'],
pathex=['C:\\Python27\\Scripts', '~/.wine/drive_c/Python27/Lib/site-packages'],
binaries=None,
datas=None,
hiddenimports=[],
hookspath=[],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher)
Step 3: rebuild
$ wine pyinstaller.exe ProcessSpreadsheet.spec
Refer to here for the detailed description.