Python Pyinstaller ERRNO 22 无效参数

我正在尝试使用 pyinstaller 使我的 python 代码更加用户友好,直到昨天,它还在工作。今天运行时出现以下错误:


C:\Users\user\Desktop\PythonProjects38>pyinstaller --onefile TransmittalEXE.py

83 INFO: PyInstaller: 4.0

83 INFO: Python: 3.8.5

83 INFO: Platform: Windows-10-10.0.18362-SP0

84 INFO: wrote C:\Users\user\Desktop\PythonProjects38\TransmittalEXE.spec

...

31623 INFO: checking PKG

31623 INFO: Building PKG because PKG-00.toc is non existent

31628 INFO: Building PKG (CArchive) PKG-00.pkg

41852 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.exe

41915 INFO: checking EXE

41917 INFO: Building EXE because EXE-00.toc is non existent

41921 INFO: Building EXE from EXE-00.toc

41927 INFO: Updating manifest in C:\Users\user\Desktop\PythonProjects38\build\TransmittalEXE\run.exe.d66z9a0v

42037 INFO: Updating resource type 24 name 1 language 0

42050 INFO: Appending archive to EXE C:\Users\user\Desktop\PythonProjects38\dist\TransmittalEXE.exe

Traceback (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。


还有其他人遇到过这个问题吗?我在这个论坛上看到过类似的问题,但不是这个确切的问题。


狐的传说
浏览 124回答 4
4回答

元芳怎么了

我遇到了同样的问题,我可以通过转到 Windows 防病毒保护选项并添加我的脚本所在的文件夹作为例外来修复它。转到“开始”>“设置”>“更新和安全”>“Windows 安全”,然后选择“病毒和威胁防护”。在“病毒和威胁防护设置”下,选择“管理设置”。添加包含所需脚本的文件夹作为例外。

SMILET

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

明月笑刀无情

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

沧海一幻觉

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.
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Python