跑步时Pyinstaller --onefile
,并开始得到结果.exe
,会出现多个弹出窗口,并显示以下警告:
WARNING: file already exists but should not: C:\Users\myuser\AppData\Local\Temp\_MEI90082\Cipher\_AES.cp37-win_amd64.pyd
这使得.exe
很难使用,尽管点击警告仍然允许.exe
才能正常运行。
如何摆脱这些警告?
将其放在这里以防对任何人有帮助,因为我花了一些时间找出如何做到这一点。
in the .spec
在你的 pyinstaller 项目中,将其添加到该行之后a = Analysis(...)
:
# Avoid warning
to_remove = ["_AES", "_ARC4", "_DES", "_DES3", "_SHA256", "_counter"]
for b in a.binaries:
found = any(
f'{crypto}.cp37-win_amd64.pyd' in b[1]
for crypto in to_remove
)
if found:
print(f"Removing {b[1]}")
a.binaries.remove(b)
当然你可以调整数组to_remove
以及确切的文件名.cp37-win_amd64.pyd
以匹配警告中显示的文件。
这会导致文件不包含在.exe
并且警告消失了。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)