为了账号安全,请及时绑定邮箱和手机立即绑定

Python Pyinstaller ERRNO 22 无效参数

Python Pyinstaller ERRNO 22 无效参数

狐的传说 2023-09-12 16:39:22
我正在尝试使用 pyinstaller 使我的 python 代码更加用户友好,直到昨天,它还在工作。今天运行时出现以下错误:C:\Users\user\Desktop\PythonProjects38>pyinstaller --onefile TransmittalEXE.py83 INFO: PyInstaller: 4.083 INFO: Python: 3.8.583 INFO: Platform: Windows-10-10.0.18362-SP084 INFO: wrote C:\Users\user\Desktop\PythonProjects38\TransmittalEXE.spec...31623 INFO: checking PKG31623 INFO: Building PKG because PKG-00.toc is non existent31628 INFO: Building PKG (CArchive) PKG-00.pkg41852 INFO: Building PKG (CArchive) PKG-00.pkg completed successfully.41915 INFO: Bootloader c:\users\user\desktop\pythonprojects38\venv\lib\site-packages\PyInstaller\bootloader\Windows-32bit\run.exe41915 INFO: checking EXE41917 INFO: Building EXE because EXE-00.toc is non existent41921 INFO: Building EXE from EXE-00.toc41927 INFO: Updating manifest in C:\Users\user\Desktop\PythonProjects38\build\TransmittalEXE\run.exe.d66z9a0v42037 INFO: Updating resource type 24 name 1 language 042050 INFO: Appending archive to EXE C:\Users\user\Desktop\PythonProjects38\dist\TransmittalEXE.exeTraceback (most recent call last):  File "C:\Users\user\AppData\Local\Programs\Python\Python38-32\lib\runpy.py", line 194, in _run_module_as_main    return _run_code(code, main_globals, None,  File "C:\Users\user\AppData\Local\Programs\Python\Python38-32\lib\runpy.py", line 87, in _run_code    exec(code, run_globals)  File "C:\Users\user\Desktop\PythonProjects38\pyinstaller.exe\__main__.py", line 7, in <module>  File "c:\users\user\desktop\pythonprojects38\venv\lib\site-packages\PyInstaller\__main__.py", line 114, in run    run_build(pyi_config, spec_file, **vars(args))  File "c:\users\user\desktop\pythonprojects38\venv\lib\site-packages\PyInstaller\__main__.py", line 65, in run_build    PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)有关更多参考,我尝试卸载并重新安装 pyinstaller 和 pywin32 无济于事。我的命令提示符条目是 pyinstaller --onefile TransmittalEXE.py。还有其他人遇到过这个问题吗?我在这个论坛上看到过类似的问题,但不是这个确切的问题。
查看完整描述

4 回答

?
元芳怎么了

TA贡献1798条经验 获得超7个赞

我遇到了同样的问题,我可以通过转到 Windows 防病毒保护选项并添加我的脚本所在的文件夹作为例外来修复它。

转到“开始”>“设置”>“更新和安全”>“Windows 安全”,然后选择“病毒和威胁防护”。在“病毒和威胁防护设置”下,选择“管理设置”。添加包含所需脚本的文件夹作为例外。


查看完整回答
反对 回复 2023-09-12
?
SMILET

TA贡献1796条经验 获得超4个赞

我花了几个小时寻找解决方案,几乎尝试了互联网上的所有可能的解决方案,此外,我终于通过安装较低版本(pyinstaller v5.6.2)而不是最新版本解决了问题,这解决了它我!



查看完整回答
反对 回复 2023-09-12
?
明月笑刀无情

TA贡献1828条经验 获得超4个赞

我今天遇到了同样的问题。我在 Windows 10 上安装 Anaconda。我最终尝试以管理员身份运行 anaconda 提示符并重新运行相同的 pyinstaller 命令。以管理员身份运行解决了我的问题。



查看完整回答
反对 回复 2023-09-12
?
沧海一幻觉

TA贡献1824条经验 获得超5个赞

Without the knowing of the script you are changing to exe, it is difficult to guess. The attached slice from the command line in your question about the error also says nothing, as @Eric Sunrightly pointed out. So it remains to give the reason for the error in other cases seemingly not necessarily related to your question, hoping that through the associations it will be possible to remove the cause of the error in yours and maybe in other cases. Eventually, I found this question looking for an answer to the same error. For me, the reason for the error was to provide the optional argument –icon=app.ico. It turned out that a file with the extension .ico was not an icon at all, but a different format, changed by the changing only the extension. When I changed a file saved in the format . png to .ico in the correct way pyinstaller stopped reporting an error.


查看完整回答
反对 回复 2023-09-12
  • 4 回答
  • 0 关注
  • 82 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信