簡體   English   中英

Py 到 exe 與 pyinstaller

[英]Py to exe with pyinstaller

我想從 main.py 文件創建 a.exe。 該腳本使用 2 個外部文件夾: -ffmpeg 文件夾和 ffmpeg.exe -bunch of.mp3 文件

當我嘗試使用 pyinstaller 創建 .exe 文件時,一切正常,但程序無法識別這些文件夾。如何才能包含這些文件夾?

Pyinstaller 命令:

pyinstaller main.py -F --add-data "songs\;songs\" --add-data "ffmpeg\;ffmpeg\;" -n Msg -w

該腳本還使用 awscli pip package,但 pyinstaller 沒有將它包含在 .exe 中(所有軟件包都安裝在我的 venv 中)。

有人可以幫助我嗎?

編輯:

我使用 AudioSegment 訪問.mp3 文件: AudioSegment.from_mp3(os.path.join("songs", song))

要使用 ffmpeg 我給出這個命令來定位 ffmpeg.exe 文件: os.path.join(os.sep,"ffmpeg","bin")

這兩個文件夾位於 main.py 文件的同一目錄中:

|main folder
--|main.py
--|songs
---|.mp3 files
--|ffmpeg
---|bin
----|ffmpeg .exe file

根據此處的文檔: https://pyinstaller.readthedocs.io/en/stable/spec-files.html ,您需要使用規范文件。

如果 package 在您的 venv 中,您應該在您的環境中運行 PyInstaller。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM