使用pyexcel读取和编写使用py2exe编译的.xls文件的项目。
我在编译并确认pyexcel,pyexcel-io和pyexcel-xls位于library.zip文件夹后出现此错误。
Traceback (most recent call last):
File "FundDatabase.pyo", line 391, in get_worksheet
File "pyexcel\core.pyo", line 118, in get_book
File "pyexcel\core.pyo", line 137, in _get_book
File "pyexcel\sources\file_source_input.pyo", line 52, in get_data
File "pyexcel_io\io.pyo", line 31, in get_data
File "pyexcel_io\io.pyo", line 118, in load_data_new
File "pyexcel_io\manager.pyo", line 94, in create_reader
File "pyexcel_io\manager.pyo", line 89, in _get_a_handler
IOError: No suitable library found for xls
答案 0 :(得分:0)
简答
您需要告诉pyinstaller有关pyexcel-xls的隐藏导入。
要打包pyexcel-xls,您需要指定:
--hidden-import pyexcel_xls
--hidden-import pyexcel_xls.xlsr
--hidden-import pyexcel_xls.xlsw
参考:mechanism of dynamic load module, confilict with pyinstaller/cx_freeze's execution
长答案
从版本0.5.0开始,pyexcel使用lazy loading,这会给pystaller带来问题,因为并非所有模块都在程序启动时加载。因此,您需要告诉pyinstaller缺少的导入(a.k.a隐藏导入)。
Pyinstaller说明