我正在尝试使用pyinstaller部署我的python项目。我的spec文件如下,它依赖于sklearn:
block_cipher = None
a = Analysis(['MainUserInterface.py'],
pathex=['..\\TSCExcelToolSet'],
binaries=[],
datas=[],
hiddenimports=['sklearn'],
hookspath=[],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False)
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
exe = EXE(pyz,
a.scripts,
exclude_binaries=True,
a.zipfiles,
a.datas,
[],
name='MainUserInterface',
debug=False,
strip=False,
upx=False,
console=True)当我试着跑的时候
pyinstaller MainUserInterface.spec它会给出这个错误:
SyntaxError: positional argument follows keyword argument

发布于 2019-06-02 11:31:12
您正在尝试传递exclude_binaries=True,它将被转换为位置参数,由于它在关键字参数a.zipfiles、a.datas和[]之前传递,因此它将提供一个SyntaxError。所以你需要在关键字参数后传递它。你可以在here上找到更多信息。
block_cipher = None
a = Analysis(['MainUserInterface.py'],
pathex=['..\\TSCExcelToolSet'],
binaries=[],
datas=[],
hiddenimports=['sklearn'],
hookspath=[],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False)
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
exe = EXE(pyz,
a.scripts,
a.zipfiles,
a.datas,
[],
exclude_binaries=True,
name='MainUserInterface',
debug=False,
strip=False,
upx=False,
console=True)https://stackoverflow.com/questions/56406009
复制相似问题