0

I use Pyinstaller to pack my program , when i run the EXE , show error message : ImportError: No module named 'xlsxwriter'

i am very sure the program can be Run, and xlsxwriter have been install success.

would you pls help me to fix this problem ?

thank you .

below is the .spec file

# -*- 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 )
Brave ru
  • 61
  • 7
  • Have you tried some solutions to similar problems? Maybe [here](http://stackoverflow.com/a/25848112/4545777)? Are you getting any error during the compilation? – Cnly Jul 16 '16 at 12:30
  • Possible duplicate of [pyinstaller, spec file, ImportError: No module named 'blah'](http://stackoverflow.com/questions/7436132/pyinstaller-spec-file-importerror-no-module-named-blah) – user1251007 Jan 26 '17 at 10:13

1 Answers1

1

I had the same issue, you have to include the module on hidden parameter of the spec file:

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)
Ivan
  • 1,069
  • 1
  • 9
  • 14