编译程序时无法包含图标

I cannot include an icon when I compile my program

我正在使用 pyinstaller 来编译我的程序。我不能包含带有 -i 选项的文件。它不编译,而是给出错误。整个编译器崩溃。我的错误代码在这里:https://pastebin.com/raw/UBTTMmke 我在 shift+右键单击资源管理器中的目录后使用了 powershell。

  1. 确保您首先 'cd' 在脚本的文件夹目标上。
  2. 确保您的图像文件已转换为 .ico 文件并且也在脚本的文件夹中

然后尝试将您的脚本编译为:

pyinstaller --onefile --icon Your_logo.ico My_script.py

此外,如果您希望控制台在脚本为 运行 时不弹出,您可以使用 'windowed' 选项:

pyinstaller --onefile --windowed --icon Your_logo.ico My_script.py