无法将pyexcel-xls与pyinstaller一起使用。python可执行文件不起作用。python版本3.4.4

Yas*_*waj 3 python windows executable xls pyinstaller

该程序在使用以下程序运行时可以运行:

Python filename.py
Run Code Online (Sandbox Code Playgroud)

但是当我使用“ pyinstaller ” 创建其可执行文件时

pyinstaller -F filename.py
Run Code Online (Sandbox Code Playgroud)

可执行文件已成功创建,但脚本执行失败,并引发以下错误。

Traceback (most recent call last):
  File "site-packages\pyexcel_io\manager.py", line 160, in create_reader
  File "site-packages\pyexcel_io\manager.py", line 222, in _get_a_handler
pyexcel_io.manager.NoSupportingPluginFound: No suitable library found for xls

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "script.py", line 8, in <module>
  File "site-packages\pyexcel_xls\__init__.py", line 29, in get_data
  File "site-packages\pyexcel_io\io.py", line 36, in get_data
  File "site-packages\pyexcel_io\io.py", line 126, in load_data
  File "site-packages\pyexcel_io\manager.py", line 171, in create_reader
pyexcel_io.manager.SupportingPluginAvailableButNotInstalled: Please install pyexcel-xls
Failed to execute script script
Run Code Online (Sandbox Code Playgroud)

各自的python脚本是:

from pyexcel_xls import save_data , get_data
data = get_data("registered-market-makers-by-security.xls")
save_data("file_to_consume.xls", data)
Run Code Online (Sandbox Code Playgroud)

如何避免此错误并创建功能正常的.exe文件?

我的客户有Windows环境。

我也尝试过py2exe,但是它与我的计算机中的Windows dll有一些冲突。

Ste*_*uch 5

问题

pyexcel-io使用一种方法来包含pyinstaller不支持的插件。看到这个问题

解决方法

解决此问题的方法有两个方面。

pyexcel需要更改

我已经提交了一个更改请求,其中显示了如何修改pyexcel以使其能够与pyinstaller一起使用。基本上pyexcel-io需要知道如何找到冻结的模块。

如果pyexcel家伙接了变更请求,那将助您一臂之力。但是如果不这样做,或者您很着急,那么可以将更改请求中的更改文件复制到您的站点软件包目录中,pyexcel_io/__init__.py以使pyexcel正常工作。

但是,pyinstaller还需要知道要包含的内容。

pyinstaller还需要知道包括所需的模块。因此,在pyinstaller命令行上,您还需要执行以下操作:

--hidden-import pyexcel_xls.xls
Run Code Online (Sandbox Code Playgroud)

更新:

带有此修复程序的更改请求已合并到 pyexcel的master分支中。

更新#2:

修复程序已发布pypi