【发布时间】:2020-10-08 09:57:25
【问题描述】:
尝试将我的一个 python 文件转换为 EXE 以供我的朋友和我一起使用。
IT 今天早些时候工作了。没有改变任何实质内容,现在我收到以下错误:
278151 ERROR: An error occurred while packaging
Traceback (most recent call last):
File "C:\Users\lewy1\AppData\Roaming\Python\Python38\site-packages\auto_py_to_exe\packaging.py", line 131, in package
run_pyinstaller()
File "C:\Users\lewy1\AppData\Roaming\Python\Python38\site-packages\PyInstaller\__main__.py", line 114, in run
run_build(pyi_config, spec_file, **vars(args))
File "C:\Users\lewy1\AppData\Roaming\Python\Python38\site-packages\PyInstaller\__main__.py", line 65, in run_build
PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
File "C:\Users\lewy1\AppData\Roaming\Python\Python38\site-packages\PyInstaller\building\build_main.py", line 720, in main
build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
File "C:\Users\lewy1\AppData\Roaming\Python\Python38\site-packages\PyInstaller\building\build_main.py", line 667, in build
exec(code, spec_namespace)
File "C:\Users\lewy1\AppData\Local\Temp\tmpupp0c450\ProjectEXE.spec", line 20, in <module>
exe = EXE(pyz,
File "C:\Users\lewy1\AppData\Roaming\Python\Python38\site-packages\PyInstaller\building\api.py", line 446, in __init__
self.__postinit__()
File "C:\Users\lewy1\AppData\Roaming\Python\Python38\site-packages\PyInstaller\building\datastruct.py", line 160, in __postinit__
self.assemble()
File "C:\Users\lewy1\AppData\Roaming\Python\Python38\site-packages\PyInstaller\building\api.py", line 622, in assemble
with open(exe, 'rb') as infh:
OSError: [Errno 22] Invalid argument: 'C:\\Users\\lewy1\\AppData\\Local\\Temp\\tmpupp0c450\\build\\ProjectEXE\\run.exe.db9ln703'
我注意到当这个错误发生时,windows defende 会弹出通知我“特洛伊木马” :Win32/Wacatac.D3!ml' 我以前在使用 pyinstaller 时从未注意到这一点。
所以我的问题是,有人知道此问题的任何修复方法吗?
编辑: 我刚刚选择了 onedir 而不是 onefile 并且它已经工作了。希望这可能有助于解决问题
【问题讨论】:
-
谢谢@CarloZanocco,这给了我找到解决方法的基础研究!虽然不理想,但我只是暂时禁用了 windows anit 病毒并且它起作用了