[英]Unable to run exe file created by pyinstaller, showing error "google-api-python-client was not found"
I am trying to convert a python script to.exe that uses the keys.json file to run.我正在尝试将 python 脚本转换为使用 keys.json 文件运行的.exe。 When I try to run the.exe file I get an error and the window closes automatically in 1-2 seconds.当我尝试运行 .exe 文件时出现错误,window 会在 1-2 秒内自动关闭。
I'm completely lost, I tried some solutions available on the internet but nothing is working, I'm very upset.我完全迷路了,我尝试了一些互联网上可用的解决方案,但没有任何效果,我很沮丧。
My.spec file looks like, My.spec 文件看起来像,
# -*- mode: python ; coding: utf-8 -*-
block_cipher = None
a = Analysis(['SMIDST.py'],
pathex=['D:\\code\\SBF Interns APP\\SMIDST'],
binaries=[],
datas=[('keys.json', '.')],
hiddenimports=['pkg_resources.py2_warn', 'googleapiclient', 'apiclient'],
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.binaries,
a.zipfiles,
a.datas,
[],
name='SMIDST',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
upx_exclude=[],
runtime_tmpdir=None,
console=True )
Please help me, Thank you in advance !!!请帮助我,在此先谢谢您!!!
Can you change the file read function to embed the file manualy?您可以更改读取 function 的文件以手动嵌入文件吗? If it works maybe it cant find the file.如果它有效,它可能无法找到该文件。 To solve that problem you can try copying the exe to where you main funciton or where you command line sits when its run(pwd path)?要解决该问题,您可以尝试将 exe 复制到您的主要功能或命令行运行时所在的位置(pwd 路径)?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.