2016-07-16 28 views
0

我用Pyinstaller收拾我的程序, 當我運行的EXE,顯示錯誤消息: 導入錯誤:沒有模塊名爲「xlsxwriter」導入錯誤:沒有模塊名爲「xlsxwriter」 - 當我使用Pyinstaller收拾程序

我很肯定程序可以運行, 和xlsxwriter已經安裝成功。

你能幫我解決這個問題嗎?

謝謝。

下面

是代表.spec文件

# -*- mode: python -*- 
block_cipher = None 
a = Analysis(['Main.py'], 
     pathex=['C:\\Users\\510428\\Desktop\\Ming and Sonic project\\Python_MingAndSonic'], 
     binaries=None, 
     datas=None, 
     hiddenimports=[], 
     hookspath=None, 
     runtime_hooks=None, 
     excludes=None, 
     win_no_prefer_redirects=None, 
     win_private_assemblies=None, 
     cipher=block_cipher) 
pyz = PYZ(a.pure, a.zipped_data, 
     cipher=block_cipher) 
exe = EXE(pyz, 
     a.scripts, 
     a.binaries, 
     a.zipfiles, 
     a.datas, 
     name='Main', 
     debug=False, 
     strip=None, 
     upx=True, 
     console=True) 
+0

您是否嘗試過一些解決方案,以類似問題?也許[這裏](http://stackoverflow.com/a/25848112/4545777)?編譯過程中是否有錯誤? – Cnly

+0

[pyinstaller,spec文件,ImportError:沒有名爲'blah'的模塊]可能的重複(http://stackoverflow.com/questions/7436132/pyinstaller-spec-file-importerror-no-module-named-blah) – user1251007

回答

1

我有同樣的問題,你必須包括在規範文件的隱藏參數模塊:

a = Analysis(['Main.py'], 
    pathex=['C:\\Users\\510428\\Desktop\\Ming and Sonic project\\Python_MingAndSonic'], 
    binaries=None, 
    datas=None, 
    hiddenimports=['xlsxwriter'], #here 
    hookspath=None, 
    runtime_hooks=None, 
    excludes=None, 
    win_no_prefer_redirects=None, 
    win_private_assemblies=None, 
    cipher=block_cipher) 
相關問題