本文介绍了无法将pyexcel-xls与pyinstaller一起使用. python可执行文件不起作用. python版本3.4.4的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

The program works when run using:

Python filename.py

但是当我使用" pyinstaller "

pyinstaller -F filename.py

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

the executable is successfully created, but execution of the script fails and following error is thrown.

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

相应的python脚本是:

The respective python script is :

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

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

How can I avoid this error and create a functional .exe file?

我的客户端具有Windows环境.

My client has windows environment.

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

I have also tried py2exe but it has some conflicts with windows dll's in my machine.

推荐答案

问题

pyexcel-io使用一种方法来包含pyinstaller不支持的插件.参见此问题.

pyexcel-io uses a method for including plug-ins that pyinstaller does not support. See this issue.

解决方法

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

The work around for this issue has a couple of facets.

需要对pyexcel进行更改

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

I have submitted a Change Request which shows how to modify pyexcel to allow it to work with pyinstaller. Basically pyexcel-io needs to know how to find frozen modules.

如果pyexcel专家们收到了更改请求,那么您就可以开始了.但是,如果他们不这样做,或者您很着急,请复制将更改请求中的更改文件作为pyexcel_io/__init__.py进入您的网站包目录,即可使pyexcel正常工作.

If the pyexcel guys pick up the Change Request, then that will get you going. But if they don't, or you are in a hurry, then copying the changed file from the change request into your site package directory as pyexcel_io/__init__.py will get pyexcel working.

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

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

pyinstaller also needs to know to include the required module. So on the pyinstaller command line you will also need to do:

--hidden-import pyexcel_xls.xls

更新:

对此修复程序的更改请求已合并到pyexcel的主分支中.

Change request with this fix has been merged into master branch of pyexcel.

更新#2:

已将已发布修正为 pypi .

这篇关于无法将pyexcel-xls与pyinstaller一起使用. python可执行文件不起作用. python版本3.4.4的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-23 02:40