我使用Pyinstaller打包我的程序, 当我运行EXE时,显示错误消息: ImportError:没有名为' xlsxwriter'
的模块我非常确定程序可以运行, 和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 :(得分:1)
我遇到了同样的问题,你必须将模块包含在spec文件的隐藏参数中:
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)