将python文件转换为exe给我一个错误,找不到openpyxl。我猜想在使用pyinstaller时必须使用隐藏导入,但是由于某些原因它没有任何区别。我该如何运作?
#test.py
from openpyxl import Workbook
import datetime
wb = Workbook()
ws = wb.active
ws['A1'] = 42
ws.append([1, 2, 3])
ws['A2'] = datetime.datetime.now()
wb.save("sample.xlsx")
pyinstaller --hidden-import = openpyxl test.py
# openpyxl not found in PYZ
Traceback (most recent call last):
File "test.py", line 1, in <module>
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
pyinstaller 3.4
Python 3.6.3
Windows 10