2013-10-18 37 views
0

PyInstaller誤導性定義爲用戶包括.icns標誌,但它實際上什麼都不做記錄:PyInstaller不更新IC

-i FILE.ICO, -i FILE.EXE,ID, -i FILE.ICNS, --icon=FILE.ICO, --icon=FILE.EXE,ID, --icon=FILE.ICNS 
If FILE is an .ico file, add the icon to the final executable. Otherwise, the syntax 'file.exe,id' to extract the icon with the specified id from file.exe and add it to the final executable. If FILE is an .icns file, add the icon to the final .app bundle on Mac OS X (for Mac not yet implemented) 

所以這是相當絕望。下一個最好的方法當然就是用我自己的方式替換默認的PyInstaller圖標。我這樣做的腳本:

pyinstaller -y --windowed --name="foobar" --workpath="target/build" --distpath="target/dist" *.spec 

# Update the icon: PyInstaller's -i switch is not implemented for Mac 
cp "path/to/icon.icns" "target/dist/foobar.app/Contents/Resources/icon-windowed.icns" 

然而,我發現,編程這樣做會導致搜索感到困惑,因爲它已經註冊的應用程序作爲具有原始的Python圖標。但是,它不能被發現。因此,該應用程序根本沒有圖標啓動。

如何正確設置圖標?

回答

0

似乎pyinstaller的選項只與創建spec文件相關。一旦你有了spec文件,你應該在spec文件中編輯命令,而不是向命令行提供選項,這些選項將被忽略。

要查看spec文件中這些命令行選項的效果,可以使用pyi-makespec腳本(與PyInstaller一起發佈)。