简体   繁体   中英

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.

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. 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] . Refer to this SO post for help. If the error persists try installing xlrdwriter with pip install xlsxwriter .

There is a chance that you have xlrd already installed and you have not installed xlsxwriter. This can be verified with pip freeze. pip freeze will provide a list of installed packages.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM