簡體   English   中英

使用cx_Freeze(PYTHON)時導入模塊錯誤

[英]Import Module error when using cx_Freeze (PYTHON)

我花了最后2個小時在網上搜索,發現幾乎沒有任何幫助。

希望有人可以幫助我。

當使用cx_Freeze將我的.py文件轉換為.exe文件時,出現錯誤,指出找不到名為xlsxwriter的模塊。 從軟件包列表中刪除此模塊后,程序將毫無問題地進行編譯。

我的代碼:

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

    )

嘗試將包含列表添加到代碼中,例如: includes = [xlrd,xlsxwriter] 請參閱此SO帖子以獲取幫助。 如果錯誤仍然存​​在,請嘗試使用pip install xlsxwriter

您可能已經安裝了xlrd,但尚未安裝xlsxwriter。 這可以通過點子凍結來驗證。 pip freeze將提供已安裝軟件包的列表。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM