[英]Import Module error when using cx_Freeze (PYTHON)
I have spent the last 2 hours searching the web to find very little and nothing that helps. 我花了最后2个小时在网上搜索,发现几乎没有任何帮助。
Hoping someone here will be able to help me. 希望有人可以帮助我。
When using cx_Freeze to convert my .py file to a .exe files, I get an error stating no module named xlsxwriter can be found. 当使用cx_Freeze将我的.py文件转换为.exe文件时,出现错误,指出找不到名为xlsxwriter的模块。 When this module is removed from the packages list the program compiles with no problem.
从软件包列表中删除此模块后,程序将毫无问题地进行编译。
My code: 我的代码:
import cx_Freeze
Executables = [cx_Freeze.Executable("test.py")]
cx_Freeze.setup(
name="Sort PLL Bale Lists",
options={"build_exe": {"packages":['xlrd','xlsxwriter']}},
executables = Executables
)
Try adding includes list to your code eg: includes = [xlrd,xlsxwriter]
. 尝试将包含列表添加到代码中,例如:
includes = [xlrd,xlsxwriter]
。 Refer to this SO post for help. 请参阅此SO帖子以获取帮助。 If the error persists try installing xlrdwriter with
pip install xlsxwriter
. 如果错误仍然存在,请尝试使用
pip install xlsxwriter
。
There is a chance that you have xlrd already installed and you have not installed xlsxwriter. 您可能已经安装了xlrd,但尚未安装xlsxwriter。 This can be verified with pip freeze.
这可以通过点子冻结来验证。
pip freeze
will provide a list of installed packages. pip freeze
将提供已安装软件包的列表。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.